new to Haskell here.
I'd like to write:
take 1 $ take 2 [1, 2, 3] -- = 1
reversed, like this pseudocode:
[1, 2, 3] -> take 2 -> take 1 -- = 1
In Clojure, we can do this with:
(->> [1 2 3]
(take 2)
(take 1)) ;=> (1)
Clojure does this because ->> is a macro that rewrites the expression to (take 1 (take 2 [1 2 3])), but because Haskell is lazy and has partials and whatnot, it seems like it should be easy.
I want to do this because having the data first then reading the functions in order that they are executed is a lovely way to read code. I have been spoiled by Clojure!
It's similar to the fluent interface / chain pattern of var.action1().action2() etc, in object oriented languages.
I imagine this is possible in Template Haskell, but surely there's a builtin way to do this that I don't yet know? Thanks!