I have released version 0.0.1 of control-block. Those of you who enjoy -XBlockArguments and -XLambdaCase may find this library useful: it provides variants of frequently-used functions (fmap, filter, foldl', …) with different argument orders: the function argument is passed last, so that complex functions can be passed anonymously, and case splits for Maybe and [] can be written even more consisely.
Its only dependencies are indexed-traversable (imap, ifoldMap, …) and witherable (filter, mapMaybe, …) to provide switched versions of those functions as well.
Usage with (&) is still subject to precedence rules, and may be parsed as part of the body of the function you’d be using. I mentioned -XLambdaCase because it allows immediate definition of the function body without wrapping in parentheses or requiring a let or where block to name it. Consider the following contrived example:
example = reduce [1 .. 100] \case
n | n `mod` 25 == 0 -> "."
| n `mod` 37 == 0 -> "#"
| otherwise -> " "
> example
" . # . #. ."
c.f.
example = foldMap f [1 .. 100]
where
f n
| n `mod` 25 == 0 = "."
| n `mod` 37 == 0 = "#"
| otherwise = " "
In expressions where the type inside the Foldable has many constructors, this becomes more convenient.