When we have the expression:
(fmap . fmap) function nested_functor
I would expect it to translate to something like
fmap (fmap function nested_functor)
Though it surprisingly seems to behave as
fmap (fmap function) nested_functor
Why?
Well, just look at the definition of (.):
(f . g) x = f (g x)
So,
(fmap . fmap) function = fmap (fmap function)
Adding an additional argument at the end doesn't really change the equation -- just makes it more specific.
(fmap . fmap) function nested_functor = fmap (fmap function) nested_functor
(N.B. function application is left associative, so f x y means (f x) y.)
a->b->cis the same asa->(b->c). Build from here. - n. 1.8e9-where's-my-share m.f x yis the same as(f x) y. (f :: a->(b->c),x :: a,y :: b) - Will Ness