strict-0.3.2: Strict data types and String IO.

Copyright(c) 2006-2007 Roman Leshchinskiy
LicenseBSD-style (see the file LICENSE)
MaintainerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

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) Source # 

Methods

fmap :: (a -> b) -> Either a a -> Either a b #

(<$) :: a -> Either a b -> Either a a #

(Eq b, Eq a) => Eq (Either a b) Source # 

Methods

(==) :: Either a b -> Either a b -> Bool #

(/=) :: Either a b -> Either a b -> Bool #

(Ord b, Ord a) => Ord (Either a b) Source # 

Methods

compare :: Either a b -> Either a b -> Ordering #

(<) :: Either a b -> Either a b -> Bool #

(<=) :: Either a b -> Either a b -> Bool #

(>) :: Either a b -> Either a b -> Bool #

(>=) :: Either a b -> Either a b -> Bool #

max :: Either a b -> Either a b -> Either a b #

min :: Either a b -> Either a b -> Either a b #

(Read b, Read a) => Read (Either a b) Source # 
(Show b, Show a) => Show (Either a b) Source # 

Methods

showsPrec :: Int -> Either a b -> ShowS #

show :: Either a b -> String #

showList :: [Either a b] -> ShowS #

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.