MonadFail proposal (MFP): Moving fail out of Monad

Edward Kmett ekmett at gmail.com
Wed Jun 10 10:55:10 UTC 2015


On Wed, Jun 10, 2015 at 8:46 AM, Herbert Valerio Riedel <hvr at gnu.org> 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

etc.

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.

-Edward


> _______________________________________________
>
Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150610/d0e7fe97/attachment.html>


More information about the Libraries mailing list