Add fromLeft and fromRight to Data.Either
This ticket is the result of the discussion of the proposal on the libraries mailing list to add the following two functions to Data.Either in base:
fromLeft :: a -> Either a b -> a
fromRight :: b -> Either a b -> b
The functions extract an Either a b
value for the constructors in their namesake, providing their first argument as a default value for values created using the other constructor.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |