Haskell functions left-to-right
clojure, haskell
Solution
There's nothing like this built in, but `Control.Category.(>>>)` is close: it's `flip (.)`, so you can write
f x = x $: sort $: group $: aggregate
as
f = sort >>> group >>> aggregate
There's no shortage of definitions and names for your `($:)` combinator. I think functions tend to suit the pipeline style more often than simple applications, so I don't feel any great need for it; `(>>>)` is a bit ugly, though.
(Besides, Haskell's non-strict semantics mean that the flow of data isn't necessarily in the direction the arrows are pointing here; after all, `aggregate` could provide the first constructor before `sort` even gets a chance to look at the argument. So I tend to just use `(.)` and `($)`; I'm used to the order.)
Problem
I have a function that I use quite frequently, which allows me to write my code in a way which seems more natural to me. ``` infixl 6 $: ($:) :: a -> (a -> b) -> b a $: f = f a ``` This lets me do something like ``` let x = getData $: sort $: group $: aggregate ``` instead of ``` let x = aggregate $ group $ sort $ getData ``` I recently learned that Clojure has something like this built in (I don't know much Clojure, but I think it would be written `(-> getData sort group aggregate)`?) which makes me wonder if Haskell has it built in as well. Hoogle doesn't have any results though. Are there any standard libs with something similar included? It probably makes my code hard for others to read if I have such a common part is idiosyncratic.