Yes. In fact we can make the stronger statement that all function with the type
fmap :: (a -> b) -> (F a -> F b)
such that fmap id = id
are equivalent. This actually just falls out of the type of fmap
with something called parametricity.
In your case, if >>=
and return
satisfy the monad laws, then
mFmap f a = a >>= return . f
mFmap id a = a >>= return . id
mFmap id a = a >>= return
mFmap id a = a
mFmap id = id
By the monad law that a >>= return
is just a
. Using this result, we can appeal to the free theorem we get from parametricity and we have our proof.