[Haskell-cafe] What is MonadPlus good for?

ajb at spamcop.net ajb at spamcop.net
Sun Feb 13 17:59:57 EST 2005


G'day all.

Quoting Remi Turk <rturk at science.uva.nl>:

> According to http://www.haskell.org/hawiki/MonadPlus (see also
> the recent thread about MonadPlus) a MonadPlus instance
> should obey m >> mzero === mzero, which IO doesn't. IOW, the
> MonadPlus instance for IO (defined in Control.Monad.Error)
> probably shouldn't be there.

Clearly the wiki page has not been updated to reflect the current
debate. :-)

I've changed the wording to this.  Anyone disagree?

    Note: There are theoretical reasons why ''mzero'' should be a
    right-zero for (>>=), but surprisingly few of the existing MonadPlus
    instances actually obey this law.  {{{IO}}} does not, and neither do
    any ["MonadTransformer"]s, since they may be stacked on top of {{{IO}}}.
    This suggests that either some of the extant MonadPlus instances are
    inappropriate, or that the law itself might be incorrect.  There is
    continuing debate over this, and the dust has not yet settled.

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list