MonadFail proposal (MFP): Moving fail out of Monad

Edward Kmett ekmett at
Wed Jun 10 13:59:33 UTC 2015

I don't quite follow how that would work in a way that doesn't violate the
open world assumption.

If you pattern match in a do-binding and don't have a MonadFail instance in
scope you'd get a different desugaring?

This would make the presence / absence of an instance change code
generation. Adding instances shouldn't change generated code.


On Wed, Jun 10, 2015 at 3:00 PM, Johan Tibell <johan.tibell at>

> An idea. Could the new desugaring be the same as for normal functions with
> a missing case? Code that uses fail would have to add the constraint still,
> but code that really didn't want to use fail would 1) get a warning about
> an incomplete pattern match and 2) get a runtime error for the failed
> pattern match produced by GHC. Is there anything I'm not thinking of here
> why this wouldn't work?
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list