Proposal: Applicative => Monad: Call for consensus

Isaac Dupree ml at isaac.cedarswampstudios.org
Tue Jan 4 01:22:09 CET 2011


On 01/03/11 17:30, Bas van Dijk wrote:
> ...
> The patch for base makes a few changes:
>
> 1) Make Applicative a superclass of Monad. So the new hierarchy becomes:
>
> 2) Make 'join' a method of Monad.
> ...
> class Applicative m =>  Monad m  where
>...
>      (>>) :: forall a b. m a ->  m b ->  m b
>      (>>) = (*>)

The former/current default definition of (>>) was based on (>>=), not 
(*>) (which if itself is undefined, itself defaults to (fmap (const id) 
a <*> b).  That's a change.

You also added defaults for most of the Monad methods, though they're 
obvious and I approve.  The (>>) default might have worse performance 
than the previous default though?  (>>) is used in do-notation 
desugaring, and yet many (most?) Monad instance writers do not 
explicitly define it, so its default makes some difference.  Does anyone 
know how to test?

-Isaac



More information about the Libraries mailing list