
Hello, I know we have discussed this before, I am just posting this so that it does not appear that the "community" does not care. Here is a summary of why I think Functor should be a super class of Monad. The extra code that a programmer would have to write is very small:
instance Functor MyMonad where fmap f m = do { x <- m; return (f x) } (or use liftM)
Furthermore, I don't think I have defined a new monad for ages,
instead I use a library which already has all the necessary instances.
The benefit of having Functor as a super class of Monad shows up in
polymorhic code: we can reduce contexts like '(Functor m, Monad m)' to
just 'Monad m'. Currently I sometimes use 'liftM' (or the 'do' form
like above) instead of using 'fmap' just to avoid having the extra
constraints, which probably makes my code less readable.
-Iavor
On 8/13/06, Lennart Augustsson
If I remember right, Functor was a superclass of Monad in Haskell early on, but it was taken away. I think this was the wrong decision, but I seem to remember that the rationale was that it would be too onerous to require programmers to write a Functor instance every time they want a Monad instance. Bah!
-- Lennart