Module Data.Either

Library with some useful operations for the Either data type.

Category
general
Author
Bjoern Peemoeller
Version
November 2020

Exported Functions: fromLeft, fromRight, isLeft, isRight, lefts, partitionEithers, rights


Exported Functions


lefts :: [Either a b] -> [a]  Deterministic 

Extracts from a list of Either all the Left elements in order.


rights :: [Either a b] -> [b]  Deterministic 

Extracts from a list of Either all the Right elements in order.


isLeft :: Either a b -> Bool  Deterministic 

Return True if the given value is a Left-value, False otherwise.

Further infos:
  • solution complete, i.e., able to compute all solutions

isRight :: Either a b -> Bool  Deterministic 

Return True if the given value is a Right-value, False otherwise.

Further infos:
  • solution complete, i.e., able to compute all solutions

fromLeft :: Either a b -> a  Deterministic 

Extract the value from a Left constructor.

Further infos:
  • partially defined

fromRight :: Either a b -> b  Deterministic 

Extract the value from a Right constructor.

Further infos:
  • partially defined

partitionEithers :: [Either a b] -> ([a], [b])  Deterministic 

Partitions a list of Either into two lists. All the Left elements are extracted, in order, to the first component of the output. Similarly the Right elements are extracted to the second component of the output.