strict-base-types-0.4.0: Strict variants of the types provided in base.

Copyright(c) 2006-2007 Roman Leshchinskiy (c) 2013 Simon Meier
LicenseBSD-style (see the file LICENSE)
MaintainerSimon Meier <iridcode@gmail.com>
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell98

Data.Either.Strict

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 :: * -> * -> *

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) 
type Rep (Either a b) 

isRight :: Either a b -> Bool

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

isLeft :: Either a b -> Bool

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

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

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.

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.

_Left :: Prism (Either a c) (Either b c) a b Source

Analogous to _Left in Control.Lens.Prism.

_Right :: Prism (Either c a) (Either c b) a b Source

Analogous to _Right in Control.Lens.Prism.