
On Thu, Jul 21, 2011 at 8:31 AM, Ivan Lazar Miljenovic
Well, for fmap vs liftM, you have that liftM is automatically defined for you rather than needing to make the Functor instance, so if you're quickly defining a Monad for internal use then you can just use liftM, etc. without needing to also make Functor and Applicative instances (note that AFAIK, return and pure are the same thing, in that return isn't automatically defined like liftM is).
Note that even if we had "class Applicative m => Monad m where ...", we could say data X a = ... instance Functor X where fmap = liftM instance Applicative X where pure = return (<*>) = ap instance Monad X where return = ... x >>= f = ... So you just need five more lines of boilerplate to define both Functor and Applicative. Cheers, -- Felipe.