In the documenation for Data.Functor the following two are stated as the functor laws, which all functors should adhere to.
fmap id == id
fmap (f . g) == fmap f . fmap g
The way my intuition tells me functors should work is that they should be "structure preserving", or in other words, if you have a function f :: a -> b
and it's inverse g :: b -> a
then
fmap f . fmap g == id
I have not been able to come up with an implementation of fmap
that would adhere to the first two laws and violate the second, but that's hardly proof. Can someone enlighten me?