Module Data.Either

Library with some useful operations for the Either data type.

Author: Bjoern Peemoeller

Version: November 2020

Summary of exported operations:

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.
isRight :: Either a b -> Bool  Deterministic 
Return True if the given value is a Right-value, False otherwise.
fromLeft :: Either a b -> a  Deterministic 
Extract the value from a Left constructor.
fromRight :: Either a b -> b  Deterministic 
Extract the value from a Right constructor.
partitionEithers :: [Either a b] -> ([a],[b])  Deterministic 
Partitions a list of Either into two lists.

Exported operations:

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.

fromRight :: Either a b -> b  Deterministic 

Extract the value from a Right constructor.

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.