[Haskell-cafe] Stacking monads

Jonathan Cast jonathanccast at fastmail.fm
Fri Oct 3 15:59:16 EDT 2008


On Fri, 2008-10-03 at 21:02 +0100, Andrew Coppin wrote:
> Jonathan Cast wrote:
> > On Fri, 2008-10-03 at 20:43 +0100, Andrew Coppin wrote:
> >   
> >> OK. So it's broken "for compatibility" then? (Presumably any time you
> >> change something from the Prelude, mass breakage ensues!)
> >>     
> >
> > I'm not a big fan of backward-compatibility myself, but changing Monad
> > to be a sub-class of Applicative actually would have broken every monad
> > instance in existence (at the time Applicative was added, since it
> > didn't have any instances yet).  I don't know what proportion of Haskell
> > programs/libraries/etc. have at least one Monad instance in them, but I
> > would guess it's high.
> >   
> 
> Hmm, that's quite a lot of breakage.
> 
> So if it had been set up this way from day 1, we wouldn't be having this 
> conversation, but it's now too expensive to change it. Is that basically 
> what it comes down to?

Sort of.  (Although I note that Monad isn't a sub-class of Functor,
either, and I think those are coeval.)  It is too expensive to change it
during the period between when Applicative was discovered and now.  But
that could change in the future --- I'm sure a much higher of types with
Monad instances happen to have Applicative instances as well now.  If
that proportion rises by enough, the backward compatibility argument
would become less compelling.

jcc




More information about the Haskell-Cafe mailing list