
25 Aug
2006
25 Aug
'06
10:09 p.m.
Jon Fairbairn wrote:
There has been discussion in the past about whether Monad should be defined as
class Functor m => Monad m where ...
It's more complicated now that we have Ross Patterson's "Applicative". http://haskell.org/ghc/dist/current/docs/libraries/base/Control-Applicative.... The correct decl I think is this: class Applicative m => Monad m where -- remove "return" ... and changing the names of the Applicative functions: class Functor f => Applicative f where return :: a -> f a ap :: f (a -> b) -> f a -> f b This would mean moving Applicative into the Prelude. I think "joining up the classes" is a good idea, and there may be other cases too. "Alternative" and "MonadPlus"? -- Ashley Yakeley