haskell-issues
haskell-issues copied to clipboard
Add instance IsString e => MonadFail (Either e) to Control.Monad.Fail
http://ircbrowse.net/browse/haskell?id=23946308×tamp=1483313566#t1483313566 (irrelevant lines taken):
<libscott> Anyone here use Control.Monad.Except?
<libscott> kind of a drag that `fail` doesn't return a Left
<libscott> also it doesn't export a utility function to convert an Either to an ExceptT
<Cale> libscott: It's not a drag -- that allows the instance of Monad to apply to more than Either String
<Cale> :t fail
<lambdabot> Monad m => String -> m a
<Cale> If you tried to say that fail = Left
<Cale> Then it only works for Either String, and not for other types
<Gurkenglas> Then why don't we have MonadFail (Either String)?
<Gurkenglas> fail's on track to leave Monad anyway
<Gurkenglas> (Or rather IsString e => MonadFail (Either e))
<Cale> Gurkenglas: Yes, that would be the sensible thing
See https://ghc.haskell.org/trac/ghc/ticket/12160 and https://mail.haskell.org/pipermail/libraries/2016-August/027251.html. The previous proposal at libraries
hasn't received much discussion, so I'll make a new proposal at some point (probably soon).