I like to think of fmap as a converting a normal function into a function that operates "through" a functor. This is clearer looking at the Haskell type signature, which can be written as:
In general, thinking about the different valid rewrites of the type signatures of the various higher order functions in Haskell tends to reveal quite a bit!
Comments
I've always liked this visualisation too!
I like to think of fmap as a converting a normal function into a function that operates "through" a functor. This is clearer looking at the Haskell type signature, which can be written as:
In general, thinking about the different valid rewrites of the type signatures of the various higher order functions in Haskell tends to reveal quite a bit!