[Haskell] Long live Edison

ajb at spamcop.net ajb at spamcop.net
Mon Feb 20 17:29:16 EST 2006

G'day again.

Quoting Robert Dockins <robdockins at fastmail.fm>:

> There are a number of methods which take a monad context and call
> 'fail' (rather than error) under some conditions, usually when the
> data structure is empty


> I am considering moving to a MonadPlus context and calling 'mzero' in
> the failure case.

The problem with MonadPlus is that you don't actually need the Plus
functionality.  It is usually considered good design to only require
what you need, and Monad already has "fail".

There has been some discussion on haskell-prime about resurrecting the
MonadZero class, for monads with mzero but not mappend.  This would be
the closest fit, but then, you might want to consider that some people
would appreciate having the string diagnostic.

Andrew Bromage

More information about the Haskell mailing list