DA.Either
TheEither 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).
Module Snapshot
Lifecycle
Stable.
Notices
Status:
active
Introduced in: 3.4.9
Removed in: -
Warnings: 0
Deprecations: 0
Deprecated since: -Functions
lefts
lefts : [Either a b] -> [a]
Extracts all the Left elements from a list.
rights
rights : [Either a b] -> [b]
Extracts all the Right elements from a list.
partitionEithers
partitionEithers : [Either a b] -> ([a], [b])
Partitions a list of Either into two lists, the Left and
Right elements respectively. Order is maintained.
isLeft
isLeft : Either a b -> Bool
Return True if the given value is a Left-value, False
otherwise.
isRight
isRight : Either a b -> Bool
Return True if the given value is a Right-value, False
otherwise.
fromLeft
fromLeft : a -> Either a b -> a
Return the contents of a Left-value, or a default value
in case of a Right-value.
fromRight
fromRight : b -> Either a b -> b
Return the contents of a Right-value, or a default value
in case of a Left-value.
optionalToEither
optionalToEither : a -> Optional b -> Either a b
Convert a Optional value to an Either value, using the supplied
parameter as the Left value if the Optional is None.
eitherToOptional
eitherToOptional : Either a b -> Optional b
Convert an Either value to a Optional, dropping any value in
Left.
maybeToEither
maybeToEither : a -> Optional b -> Either a b
eitherToMaybe
eitherToMaybe : Either a b -> Optional b