strict-0.4.0.1: Strict data types and String IO.
Safe Haskell Safe
Language Haskell2010

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
Bifunctor Either Source #
Instance details

Defined in Data.Strict.Either

Methods

bimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d Source #

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

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

Swap Either Source #
Instance details

Defined in Data.Strict.Either

Assoc Either Source #
Instance details

Defined in Data.Strict.Either

Bitraversable Either Source #
Instance details

Defined in Data.Strict.Either

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f ( Either c d) Source #

Bifoldable Either Source #
Instance details

Defined in Data.Strict.Either

Methods

bifold :: Monoid m => Either m m -> m Source #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Either a b -> m Source #

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

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

Eq2 Either Source #
Instance details

Defined in Data.Strict.Either

Methods

liftEq2 :: (a -> b -> Bool ) -> (c -> d -> Bool ) -> Either a c -> Either b d -> Bool Source #

Ord2 Either Source #
Instance details

Defined in Data.Strict.Either

Methods

liftCompare2 :: (a -> b -> Ordering ) -> (c -> d -> Ordering ) -> Either a c -> Either b d -> Ordering Source #

Read2 Either Source #
Instance details

Defined in Data.Strict.Either

Show2 Either Source #
Instance details

Defined in Data.Strict.Either

Methods

liftShowsPrec2 :: ( Int -> a -> ShowS ) -> ([a] -> ShowS ) -> ( Int -> b -> ShowS ) -> ([b] -> ShowS ) -> Int -> Either a b -> ShowS Source #

liftShowList2 :: ( Int -> a -> ShowS ) -> ([a] -> ShowS ) -> ( Int -> b -> ShowS ) -> ([b] -> ShowS ) -> [ Either a b] -> ShowS Source #

NFData2 Either Source #
Instance details

Defined in Data.Strict.Either

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> Either a b -> () Source #

Hashable2 Either Source #
Instance details

Defined in Data.Strict.Either

Functor ( Either a) Source #
Instance details

Defined in Data.Strict.Either

Methods

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

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

Foldable ( Either e) Source #
Instance details

Defined in Data.Strict.Either

Traversable ( Either e) Source #
Instance details

Defined in Data.Strict.Either

Eq a => Eq1 ( Either a) Source #
Instance details

Defined in Data.Strict.Either

Methods

liftEq :: (a0 -> b -> Bool ) -> Either a a0 -> Either a b -> Bool Source #

Ord a => Ord1 ( Either a) Source #
Instance details

Defined in Data.Strict.Either

Read a => Read1 ( Either a) Source #
Instance details

Defined in Data.Strict.Either

Show a => Show1 ( Either a) Source #
Instance details

Defined in Data.Strict.Either

NFData a => NFData1 ( Either a) Source #
Instance details

Defined in Data.Strict.Either

Methods

liftRnf :: (a0 -> ()) -> Either a a0 -> () Source #

Hashable a => Hashable1 ( Either a) Source #
Instance details

Defined in Data.Strict.Either

Generic1 ( Either a :: Type -> Type ) Source #
Instance details

Defined in Data.Strict.Either

Associated Types

type Rep1 ( Either a) :: k -> Type Source #

Methods

from1 :: forall (a0 :: k). Either a a0 -> Rep1 ( Either a) a0 Source #

to1 :: forall (a0 :: k). Rep1 ( Either a) a0 -> Either a a0 Source #

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

Defined in Data.Strict.Either

( Data a, Data b) => Data ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

Methods

gfoldl :: ( forall d b0. Data d => c (d -> b0) -> d -> c b0) -> ( forall g. g -> c g) -> Either a b -> c ( Either a b) Source #

gunfold :: ( forall b0 r. Data b0 => c (b0 -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( Either a b) Source #

toConstr :: Either a b -> Constr Source #

dataTypeOf :: Either a b -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( Either a b)) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( Either a b)) Source #

gmapT :: ( forall b0. Data b0 => b0 -> b0) -> Either a b -> Either a b Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Either a b -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Either a b -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> Either a b -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> Either a b -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Either a b -> m ( Either a b) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Either a b -> m ( Either a b) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Either a b -> m ( Either a b) Source #

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

Defined in Data.Strict.Either

( Read a, Read b) => Read ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

( Show a, Show b) => Show ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

Generic ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

Associated Types

type Rep ( Either a b) :: Type -> Type Source #

Semigroup ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

( Binary a, Binary b) => Binary ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

( NFData a, NFData b) => NFData ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

Methods

rnf :: Either a b -> () Source #

( Hashable a, Hashable b) => Hashable ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

Strict ( Either a b) ( Either a b) Source #
Instance details

Defined in Data.Strict.Classes

type Rep1 ( Either a :: Type -> Type ) Source #
Instance details

Defined in Data.Strict.Either

type Rep ( Either a b) Source #
Instance details

Defined in Data.Strict.Either

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 .