strict-0.4.0.1: Strict data types and String IO.

Data.Strict.Either

Description

The strict variant of the standard Haskell Either type and the corresponding variants of the functions from Data.Either.

Note that the strict Either type is not an applicative functor, and therefore also no monad. The reasons are the same as the ones for the strict Maybe type, which are explained in Data.Maybe.Strict.

Synopsis

# Documentation

data Either a b Source #

The strict choice type.

Constructors

 Left !a Right !b

#### Instances

Instances details

either :: (a -> c) -> (b -> c) -> Either a b -> c Source #

Case analysis: if the value is Left a, apply the first function to a; if it is Right b, apply the second function to b.

isLeft :: Either a b -> Bool Source #

Yields True iff the argument is of the form Left _.

isRight :: Either a b -> Bool Source #

Yields True iff the argument is of the form Right _.

fromLeft :: Either a b -> a Source #

Extracts the element out of a Left and throws an error if the argument is a Right.

fromRight :: Either a b -> b Source #

Extracts the element out of a Right and throws an error if the argument is a Left.

lefts :: [Either a b] -> [a] Source #

Analogous to lefts in Data.Either.

rights :: [Either a b] -> [b] Source #

Analogous to rights in Data.Either.

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

Analogous to partitionEithers in Data.Either.