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.html

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

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to