Removing MonadFail from Monad

Dan Doel dan.doel at
Tue Dec 17 17:26:45 UTC 2013

On Tue, Dec 17, 2013 at 8:18 AM, David Luposchainsky
<dluposchainsky at> wrote:
> List comprehensions are special.
> - They have their own semantics in the report. Desugaring them to `do`
> notation is a possible implementation, but I think GHC doesn't do that
> for performance reasons (-XMonadComprehensions changes this).

List comprehensions weren't special (i.e. specific to lists) in
Haskell 1.4. They worked like monad comprehensions. Then they were
changed to only work with lists in Haskell98 (and that is still the
way the standard is), which is why you need to enable an extension to
get monad comprehensions now (that it has been re-implemented).

And comprehensions, of course, have failure as a built-in notion, due
to guards. This was handled by MonadZero, as was pattern match

There was also a definition of unfailable patterns. A pattern was
unfailable if it could not be refuted except possibly by partially
defined values, as I recall. This makes irrefutable patterns trivially
unfailable, if you wish to force the issue. And GHC pretty clearly
still implements things this way, as seen in adam vogt's mail.

-- Dan

More information about the Libraries mailing list