All Monads are Functors
jon.fairbairn at cl.cam.ac.uk
Sun Aug 13 12:11:06 EDT 2006
I find myself dismayed that the mathematical relationship
between Monads and Functors isn't available in Haskell98; if
I use fmap in a Monad m=>... typed function, I get an extra
Functor m required in the context, but not only are all
mathematical monads functors, any instance of Monad has fmap
in the form (>>= return . f), so it's annoying.
There has been discussion in the past about whether Monad
should be defined as
> class Functor m => Monad m where ...
(or some other means of making all Monads instances of
Functor) I think the general consensus on the libraries
mailing list in this thread
which refers to this:
was that it would be a good thing, but it breaks Haskell98
programmes. Surely Haskell' can get this right?
On haskell prime I can find
which agrees with me, but I don't see a definite decision
either there or in the Trac.
I'd favour the above method as most conservative in terms of
the language, but I'm not too fussed how it happens.
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Haskell-prime