MonadFail instance for Either

David Feuer david.feuer at gmail.com
Thu Oct 25 07:21:51 UTC 2018


Another option is to be agnostic about it with FlexibleInstances:

    instance MonadFail (Either [Char]) where
      fail = Left

That'll work today, and leave the question of the ultimate constraint open.
It's not Haskell 2010, but no one can take advantage of that fact.

I'm only raising that as an option; I don't really like it terribly much.

On Thu, Oct 25, 2018, 3:05 AM Edward Kmett <ekmett at gmail.com> wrote:

> I'm also weakly inclined against it.
>
> If we decided we really wanted something, then building a class that was
> just for this purpose might work, sort of an updated version of the old
> 'Error' class from transformers, but now limited to just the failure string
> so it has no extra baggage.
>
> On the other hand, that then faces inertia problems all its own.
>
> -Edward
>
> On Wed, Oct 24, 2018 at 11:42 PM David Feuer <david.feuer at gmail.com>
> wrote:
>
>> FWIW, I think I'm weakly opposed. Either is Haskell 98. MonadFail is
>> solidly "standards-track" material, to the extent that designation is
>> meaningful
>> at the moment. IsString ... isn't.
>> On Wed, Oct 24, 2018 at 10:44 PM Daniel Bergey <bergey at alum.mit.edu>
>> wrote:
>> >
>> > Is there still consensus in favor of adding this instance?
>> >
>> >  instance IsString str => MonadFail (Either str) where
>> >     fail = Left . fromString
>> >
>> > In 2016 there was some discussion, and my reading is that there was
>> consensus in favor at the time:
>> > Trac: https://ghc.haskell.org/trac/ghc/ticket/12160
>> > libaries mailing list:
>> https://mail.haskell.org/pipermail/libraries/2016-August/027248.html
>> >
>> > Does anyone know of a later decision not to add it, or was it simply no
>> one's top priority?
>> >
>> > What is the next step to move this proposal forward?  Is more
>> discussion in order?  Should I just submit a patch?
>> >
>> > Thanks,
>> > bergey
>> > _______________________________________________
>> > Libraries mailing list
>> > Libraries at haskell.org
>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>> _______________________________________________
>> 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/20181025/a6c94e26/attachment.html>


More information about the Libraries mailing list