Module DA.Either¶
The Either type represents values with two possibilities.
It is sometimes used to represent a value which is either correct
or an error. By convention, the Left constructor is used to hold
an error value and the Right constructor is used to hold a correct
value (mnemonic: “right” also means correct).
Functions¶
- partitionEithers
- : [Either a b] -> ([a], [b]) - Partitions a list of - Eitherinto two lists, the- Leftand- Rightelements respectively. Order is maintained.
- fromLeft
- : a -> Either a b -> a - Return the contents of a - Left-value, or a default value in case of a- Right-value.
- fromRight
- : b -> Either a b -> b - Return the contents of a - Right-value, or a default value in case of a- Left-value.
- optionalToEither
- : a -> Optional b -> Either a b - Convert a - Optionalvalue to an- Eithervalue, using the supplied parameter as the- Leftvalue if the- Optionalis- None.
- eitherToOptional
- 
Convert an Eithervalue to aOptional, dropping any value inLeft.
- maybeToEither
- : a -> Optional b -> Either a b
- eitherToMaybe
- : Either a b -> Optional b