
On Mon, Jan 03, 2011 at 11:30:44PM +0100, Bas van Dijk wrote:
1) Make Applicative a superclass of Monad. So the new hierarchy becomes:
class Applicative m => Monad m where
Now which notable things are not included in the patch for base:
* fmap is not renamed to map. * return and (>>) are not removed as a method. * fail is not removed as a method. * All the liftM functions are not removed in favour of fmap and liftAs.
I think these are better left as separate proposals.
OK, but I think it would be good to get any changes into a single release, so people only need to fix their instances once.
(>>=) :: forall a b. m a -> (a -> m b) -> m b m >>= f = join $ fmap f m
join :: m (m a) -> m a join m = m >>= id
Have you got an example of a Monad for which you'd want to define join but not (>>=)?
(>>) :: forall a b. m a -> m b -> m b (>>) = (*>)
return :: a -> m a return = pure
fail :: String -> m a fail s = error s
2) Make 'join' a method of Monad.
Why?
6) Add a Monad instance for ((,) a): (There are already Functor and Applicative instances for it.)
(Maybe this one should be left out of the patch)
It does sound like a separate issue. Thanks Ian