I am learning Haskell recently, and I was reading Functors in Learn You a Haskell from which I came to know
- Functions
((->)r)
which take one parameter, are also in a way Functors. - Composition
(.)
is equivalent tofmap
So with what I have understood, fmap takes two parameters. First is the function to be applied, and the second one is the functor.
However, I am confused with this expression (.) (.) (.)
. This is a composition of two composition, with the type (b -> c) -> (a1 -> a2 -> b) -> (a1 -> a2 -> c)
So here is my doubt arising. The first (.)
has two parameters, first one being composition function itself. The second parameter also being the composition function. And composition function as such is not a functor. So how is this a valid expression?
I am sure that I am missing something here. Could someone fill in the gaps and help me get how the expression is correct?
(.)(.)(.)
can be understood without thinking about functors. – chi