Proposal and discussion: Add MonadFail instance to Either

Fumiaki Kinoshita fumiexcel at gmail.com
Mon Aug 15 01:43:12 UTC 2016


IsString str => MonadFail (Either str) does make sense to me. +1

2016-08-12 8:02 GMT+09:00 Tobias Markus <tobias at miglix.eu>:

> As suggested in the GHC Trac [1], it would be nice to have a MonadFail
> instance for Either. The original suggestion by lexi.lambda was
>
>   instance MonadFail (Either String) where
>     fail = Left
>
> However, it was rightfully pointed out that this instance is overly
> specific. The discussion arrived at the following alternative proposed
> by Iceland_jack:
>
>   instance IsString str => MonadFail (Either str) where
>     fail = Left . fromString
>
> For previous discussion on this proposal, please take a look at the Trac
> thread.
>
> I am looking forward to your input!
>
> Tobias
>
> [1] GHC Trac Ticket #12160, https://ghc.haskell.org/trac/ghc/ticket/12160
>
> --
> Tobias Markus
>
> "They who would give up essential Liberty, to purchase a little
> temporary Safety, deserve neither Liberty nor Safety."
>         -- Benjamin Franklin (1706-1790)
> _______________________________________________
> 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/20160815/28fb4806/attachment.html>


More information about the Libraries mailing list