Copyright | (c) 2006-2007 Roman Leshchinskiy (c) 2013 Simon Meier |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Simon Meier <iridcode@gmail.com> |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
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
- data Either a b
- isRight :: Either a b -> Bool
- isLeft :: Either a b -> Bool
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- lefts :: [Either a b] -> [a]
- rights :: [Either a b] -> [b]
- partitionEithers :: [Either a b] -> ([a], [b])
- _Left :: Prism (Either a c) (Either b c) a b
- _Right :: Prism (Either c a) (Either c b) a b
Documentation
The strict choice type.
Instances
Bifunctor Either | |
Swap Either | |
Defined in Data.Strict.Either | |
Assoc Either | |
Bitraversable Either | |
Defined in Data.Strict.Either bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) # | |
Bifoldable Either | |
Eq2 Either | |
Ord2 Either | |
Defined in Data.Strict.Either | |
Read2 Either | |
Defined in Data.Strict.Either liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Either a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Either a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Either a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Either a b] # | |
Show2 Either | |
NFData2 Either | |
Defined in Data.Strict.Either | |
Hashable2 Either | |
Defined in Data.Strict.Either | |
Functor (Either a) | |
Foldable (Either e) | |
Defined in Data.Strict.Either fold :: Monoid m => Either e m -> m # foldMap :: Monoid m => (a -> m) -> Either e a -> m # foldr :: (a -> b -> b) -> b -> Either e a -> b # foldr' :: (a -> b -> b) -> b -> Either e a -> b # foldl :: (b -> a -> b) -> b -> Either e a -> b # foldl' :: (b -> a -> b) -> b -> Either e a -> b # foldr1 :: (a -> a -> a) -> Either e a -> a # foldl1 :: (a -> a -> a) -> Either e a -> a # elem :: Eq a => a -> Either e a -> Bool # maximum :: Ord a => Either e a -> a # minimum :: Ord a => Either e a -> a # | |
Traversable (Either e) | |
Eq a => Eq1 (Either a) | |
Ord a => Ord1 (Either a) | |
Defined in Data.Strict.Either | |
Read a => Read1 (Either a) | |
Defined in Data.Strict.Either liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Either a a0) # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Either a a0] # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Either a a0) # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Either a a0] # | |
Show a => Show1 (Either a) | |
NFData a => NFData1 (Either a) | |
Defined in Data.Strict.Either | |
Hashable a => Hashable1 (Either a) | |
Defined in Data.Strict.Either | |
Generic1 (Either a :: Type -> Type) | |
(Eq a, Eq b) => Eq (Either a b) | |
(Data a, Data b) => Data (Either a b) | |
Defined in Data.Strict.Either gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> Either a b -> c (Either a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Either a b) # toConstr :: Either a b -> Constr # dataTypeOf :: Either a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Either a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Either a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> Either a b -> Either a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Either a b -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Either a b -> r # gmapQ :: (forall d. Data d => d -> u) -> Either a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Either a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Either a b -> m (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) | |
Generic (Either a b) | |
Semigroup (Either a b) | |
(Hashable a, Hashable b) => Hashable (Either a b) | |
Defined in Data.Strict.Either | |
(Binary a, Binary b) => Binary (Either a b) | |
(NFData a, NFData b) => NFData (Either a b) | |
Defined in Data.Strict.Either | |
type Rep1 (Either a :: Type -> Type) | |
Defined in Data.Strict.Either type Rep1 (Either a :: Type -> Type) = D1 (MetaData "Either" "Data.Strict.Either" "strict-0.4-DcORXBfkCIx3v5lLd1UYRe" False) (C1 (MetaCons "Left" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) :+: C1 (MetaCons "Right" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1)) | |
type Rep (Either a b) | |
Defined in Data.Strict.Either type Rep (Either a b) = D1 (MetaData "Either" "Data.Strict.Either" "strict-0.4-DcORXBfkCIx3v5lLd1UYRe" False) (C1 (MetaCons "Left" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) :+: C1 (MetaCons "Right" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b))) |
lefts :: [Either a b] -> [a] #
Analogous to lefts
in Data.Either.
rights :: [Either a b] -> [b] #
Analogous to rights
in Data.Either.
partitionEithers :: [Either a b] -> ([a], [b]) #
Analogous to partitionEithers
in Data.Either.