add Applicative instance for Either
The proposal is to add this instance to Control.Applicative:
instance Applicative (Either e) where
pure = Right
Left e <*> _ = Left e
Right f <*> r = fmap f r
This is not the only possible instance for Either, but this one is compatible with the usual Monad instance.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |