MonadFail instance for (Either String)?
I think one of the cool things about breaking out MonadFail
would be the opportunity to introduce an instance for Either String
, which isn’t possible to do with plain Monad
without overlapping instances. The instance itself would be completely trivial:
instance MonadFail (Either String) where
fail = Left
The only possible reason to not do this, as far as I can tell, would be because it requires FlexibleInstances
. This already seems to be used for a few instances in base
, and it seems like it would be extremely useful, so I would really appreciate if such an instance was defined. I’d be happy to submit a patch to add it, but I wasn’t sure if this would be an uncontroversial change or not.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries (other) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |