MonadFail proposal (MFP): Moving fail out of Monad

Thomas Bereknyei tomberek at gmail.com
Wed Jun 10 12:04:08 UTC 2015


+1 also improves the correctness of the monad laws
On Jun 10, 2015 7:46 AM, "Roman Cheplyaka" <roma at ro-che.info> wrote:

> On 10/06/15 14:22, Johan Tibell wrote:
> > On Wed, Jun 10, 2015 at 12:42 AM, David Luposchainsky
> > <dluposchainsky at googlemail.com <mailto:dluposchainsky at googlemail.com>>
> > wrote:
> >
> >     I think there are two important consequences of MonadFail. First of
> >     all, we can
> >     all safely write failable patterns if we so desire. Second, the
> >     compiler can
> >     ensure other people's codebases do not lie to us (knowingly or
> >     unknowingly).
> >
> >
> > The second is a bit overstated I think. Any function you call can still
> > have partial pattern matches in all the other places Haskell allows them
> > and you wouldn't know from the type.
>
> For most of them, at least you get a warning from GHC (not for patterns
> inside lambda, sadly, although that should be fixable). But for
>
> do
>   Just x <- a
>   ...
>
> it's not possible in principle to give a warning, because it's not clear
> whether the implicit call to fail is intended.
>
> Roman
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150610/7c8a69f6/attachment.html>


More information about the ghc-devs mailing list