MonadFail proposal (MFP): Moving fail out of Monad

Edward Kmett ekmett at
Wed Jun 10 10:55:10 UTC 2015

On Wed, Jun 10, 2015 at 8:46 AM, Herbert Valerio Riedel <hvr at> wrote:

>   {-# LANGUAGE ConstraintKinds #-}
>   type MonadFail m       = (Fail m, Monad m)
>   type ApplicativeFail m = (Fail m, Applicative m)

If we're forced into a situation where we need to factor it into a separate
class and build aliases like this, then switching to undecidable instances
and encoding that as

class (Monad m, Fail m) => MonadFail m
instance (Monad m, Fail m) => MonadFail m


would be much better than using the ConstraintKinds extension and a type
alias. The type synonym you gave doesn't let you use "MonadFail" as a first
class inhabitant of kind (* -> *) -> Constraint, you can only pass it once
it has been applied to an `m`. This rules out many useful type level tricks.


> _______________________________________________
Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list