strict-0.3.2: Strict data types and String IO.

Portabilityportable
Stabilityexperimental
MaintainerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Safe HaskellSafe-Infered

Data.Strict.Either

Description

Strict Either.

Same as the standard Haskell Either, but Left _|_ = Right _|_ = _|_

Synopsis

Documentation

data Either a b Source

The strict choice type.

Constructors

Left !a 
Right !b 

Instances

Functor (Either a) 
(Eq a, Eq b) => Eq (Either a b) 
(Ord a, Ord b) => Ord (Either a b) 
(Read a, Read b) => Read (Either a b) 
(Show a, Show b) => Show (Either a b) 

either :: (a -> c) -> (b -> c) -> Either a b -> cSource

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 -> BoolSource

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

isRight :: Either a b -> BoolSource

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

fromLeft :: Either a b -> aSource

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

fromRight :: Either a b -> bSource

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