HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleeither-n-0.1.0.0Haskell2010

Data.Either3.Either3T

Either3 inside a type constructor f, in the same way that ExceptT e m a is m (Either e a).

Use _Wrapped to convert between Either3T f a b c and f (Either3 a b c).

  • 5 types
  • 4 classes
  • 6 values
  • Packageeither-n-0.1.0.0
  • Exports15
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceEither3T.hs

Data type

1 declaration
newtypenewtype Either3T (f :: Type -> Type) a b c
#

An Either3 inside f.

Example1 expression
toConstr (Either3T [Third3 1] :: Either3TList String Bool Int)Either3T
Example1 expression
to (from (Either3T [Third3 1] :: Either3TList String Bool Int)) :: Either3TList String Bool IntEither3T [Third3 1]

Constructors

Instances57MonadRWS, Generic1, MonadError, MonadReader, MonadState, MonadWriter, …
  • MonadRWS r w s f => MonadRWS r w s (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts MonadRWS from f.

  • Functor f => Generic1 (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • MonadError e f => MonadError e (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts throwError and catchError from f, as the instance for MaybeT does. First3 and Second3 are values, not errors, so catchError does not catch them.

    Example1 expression
    view _Wrapped (throwError "e" `catchError` (\e -> pure (length e)) :: Either3T (Either String) String Bool Int)Right (Third3 1)
    Example1 expression
    view _Wrapped (review reviewEither3 (Second3 True) `catchError` (\_ -> pure 1) :: Either3T (Either String) String Bool Int)Right (Second3 True)
  • MonadReader r f => MonadReader r (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts ask and local from f, as the instance for ExceptT does.

    Example1 expression
    runReader (view _Wrapped (local (+ 1) ask :: Either3T (Reader Int) String Bool Int)) 1Third3 2
  • MonadState s f => MonadState s (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts state from f.

    Example1 expression
    runState (view _Wrapped (modify (+ 1) >> get :: Either3T (State Int) String Bool Int)) 1(Third3 2,2)
  • MonadWriter w f => MonadWriter w (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts tell, listen and pass from f, as the instance for MaybeT does.

    Example1 expression
    runWriter (view _Wrapped (tell [1] >> listen (tell [2] >> pure 'x') :: Either3T (Writer [Int]) String Bool (Char, [Int])))(Third3 ('x',[2]),[1,2])
    Example1 expression
    runWriter (view _Wrapped (pass (pure ('x', reverse)) <* tell [1, 2] :: Either3T (Writer [Int]) String Bool Char))(Third3 'x',[1,2])
    Example1 expression
    runWriter (view _Wrapped (pass (tell [1, 2] >> pure ('x', reverse)) :: Either3T (Writer [Int]) String Bool Char))(Third3 'x',[2,1])
  • Foldable f => FoldableWithIndex () (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • Functor f => FunctorWithIndex () (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    The index is always (), as for Maybe.

  • Traversable f => TraversableWithIndex () (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • Foldable f => Bifoldable (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    bifoldMap show show (Either3T [Second3 True, Third3 1] :: Either3TList String Bool Int)"True1"
  • Functor f => Bifunctor (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Maps the second and third type parameters.

    Example1 expression
    bimap not (+ 1) (Either3T [Second3 True, Third3 1] :: Either3TList String Bool Int)Either3T [Second3 False,Third3 2]
  • Traversable f => Bitraversable (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    bitraverse (Just . not) (Just . (+ 1)) (Either3T [Second3 True, Third3 1] :: Either3TList String Bool Int)Just (Either3T [Second3 False,Third3 2])
  • (Eq1 f, Eq a) => Eq2 (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • (Ord1 f, Ord a) => Ord2 (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • (Show1 f, Show a) => Show2 (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • Functor f => Swap (Either3T f a)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Swaps the second and third type parameters.

    Example1 expression
    swap (Either3T [Second3 True, Third3 1] :: Either3TList String Bool Int)Either3T [Third3 True,Second3 1]
  • Monad f => Monad (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    Either3T [Third3 1, Second3 True] >>= (\x -> Either3T [Third3 x, Third3 (x + 1)]) :: Either3TList String Bool IntEither3T [Third3 1,Third3 2,Second3 True]
  • Functor f => Functor (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    fmap (+ 1) (Either3T [Third3 1, Second3 True] :: Either3TList String Bool Int)Either3T [Third3 2,Second3 True]
  • MonadFail f => MonadFail (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts fail from f.

    Example1 expression
    fail "x" :: Either3TMaybe String Bool IntEither3T Nothing
  • Monad f => Applicative (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    pure 1 :: Either3TList String Bool IntEither3T [Third3 1]
  • Foldable f => Foldable (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    sum (Either3T [Third3 1, First3 "x", Third3 2] :: Either3TList String Bool Int)3
  • Traversable f => Traversable (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    traverse (\x -> Just (x + 1)) (Either3T [Third3 1, First3 "x"] :: Either3TList String Bool Int)Just (Either3T [Third3 2,First3 "x"])
  • MonadIO f => MonadIO (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts liftIO from f.

    Example1 expression
    view _Wrapped (liftIO (pure 1) :: Either3TIO String Bool Int)Third3 1
  • MonadZip f => MonadZip (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts mzipWith from f, combining each pair of Either3 values with liftA2, as the instance for MaybeT does.

    Example1 expression
    mzip (Either3T [Third3 1, First3 "x"]) (Either3T [Third3 True, Third3 False]) :: Either3TList String Bool (Int, Bool)Either3T [Third3 (1,True),First3 "x"]
  • (Eq1 f, Eq a, Eq b) => Eq1 (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • (Ord1 f, Ord a, Ord b) => Ord1 (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • (Show1 f, Show a, Show b) => Show1 (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • MonadCont f => MonadCont (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Lifts callCC from f, as the instance for MaybeT does.

    Example1 expression
    runCont (view _Wrapped (callCC (\k -> k 1 >> review reviewEither3 (Second3 True)) :: Either3T (Cont r) String Bool Int)) idThird3 1
  • Monad f => Alt (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    The first value that is Third3 wins, otherwise the second value, like Either.

    Example1 expression
    Either3T [Second3 True] <!> Either3T [Third3 1] :: Either3TList String Bool IntEither3T [Third3 1]
    Example1 expression
    Either3T [Second3 True] <!> Either3T [First3 "x"] :: Either3TList String Bool IntEither3T [First3 "x"]
  • Monad f => Apply (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    Runs the effects of the second argument only when the first is Third3.

    Example1 expression
    Either3T [Third3 (+ 1), First3 "x"] <.> Either3T [Third3 1, Third3 2] :: Either3TList String Bool IntEither3T [Third3 2,Third3 3,First3 "x"]
  • Monad f => Bind (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • Applicative f => Extend (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    duplicated (Either3T [Third3 1, First3 "x"] :: Either3TList String Bool Int)Either3T [Third3 (Either3T [Third3 1]),First3 "x"]
  • Monad f => Selective (Either3T f a b)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    select (pure (Left 1)) (pure (+ 1)) :: Either3TList String Bool IntEither3T [Third3 2]
  • (Eq1 f, Eq a, Eq b, Eq c) => Eq (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    Either3T [Third3 1] == (Either3T [Third3 1] :: Either3TList String Bool Int)True
    Example1 expression
    Either3T [Third3 1] == (Either3T [Second3 True] :: Either3TList String Bool Int)False
  • (Typeable f, Data a, Data b, Data c, Data (f (Either3 a b c))) => Data (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • (Ord1 f, Ord a, Ord b, Ord c) => Ord (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    compare (Either3T [First3 "x"]) (Either3T [Third3 1] :: Either3TList String Bool Int)LT
  • (Show1 f, Show a, Show b, Show c) => Show (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    Either3T [Third3 1, First3 "x"] :: Either3TList String Bool IntEither3T [Third3 1,First3 "x"]
    Example1 expression
    e3 (Second3 True)Either3T (Identity (Second3 True))
  • Generic (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • Monad f => Semigroup (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

    The first value that is Third3 wins, otherwise the second value, like Either.

    Example1 expression
    Either3T [First3 "x"] <> Either3T [Third3 1] :: Either3TList String Bool IntEither3T [Third3 1]
  • (NFData1 f, NFData a, NFData b, NFData c) => NFData (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    rnf (Either3T [Third3 1, First3 "x"] :: Either3TList String Bool Int)()
  • Wrapped (Either3T f a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    view _Wrapped (Either3T [Third3 1, First3 "x"] :: Either3TList String Bool Int)[Third3 1,First3 "x"]
    Example1 expression
    review _Wrapped [Second3 True] :: Either3TList String Bool IntEither3T [Second3 True]
  • t ~ Either3T f' a' b' c' => Rewrapped (Either3T f a b c) tDefined in either-n-0.1.0.0 · Data.Either3.Either3T

    Changes the type constructor from lists to Maybe:

    Example1 expression
    over _Wrapped (foldr (const . Just) Nothing) (Either3T [Third3 1, Third3 2] :: Either3TList String Bool Int) :: Either3TMaybe String Bool IntEither3T (Just (Third3 1))
  • AsEither3 (Either3T Identity a b c) a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    matchEither3 (e3 (Third3 1))Just (Third3 1)
    Example1 expression
    e3 (Third3 1) ^? _Either3Just (Third3 1)
  • GetEither3 (Either3T Identity a b c) a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    view getEither3 (e3 (Third3 1))Third3 1
  • HasEither3 (Either3T Identity a b c) a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    setEither3 (Second3 True) (e3 (Third3 1))Either3T (Identity (Second3 True))
  • Applicative f => ReviewEither3 (Either3T f a b c) a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T

    Any Either3 can be put in an Applicative f.

    Example1 expression
    review reviewEither3 (Second3 True) :: Either3TMaybe String Bool IntEither3T (Just (Second3 True))
  • AsEither3T (Either3T f a b c) f a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
  • GetEither3T (Either3T f a b c) f a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
  • HasEither3T (Either3T f a b c) f a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
  • ReviewEither3T (Either3T f a b c) f a b cDefined in either-n-0.1.0.0 · Data.Either3.Either3T
  • Traversable f => Each (Either3T f a a a) (Either3T f b b b) a bDefined in either-n-0.1.0.0 · Data.Either3.Either3T

    Traverses every value inside f.

    Example1 expression
    toListOf each (Either3T [First3 1, Second3 2, Third3 3] :: Either3TList Int Int Int)[1,2,3]
  • Injection1 (Either3T Identity a b c) (Either3T Identity a' b c) a a'Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    e3 (First3 "x") ^? _I1Just "x"
  • Injection2 (Either3T Identity a b c) (Either3T Identity a b' c) b b'Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    e3 (Second3 True) ^? _I2Just True
  • Injection3 (Either3T Identity a b c) (Either3T Identity a b c') c c'Defined in either-n-0.1.0.0 · Data.Either3.Either3T
    Example1 expression
    e3 (Third3 1) ^? _I3Just 1
    Example1 expression
    e3 (First3 "x") ^? _I3Nothing
  • type Rep (Either3T f a b c) = D1 ('MetaData "Either3T" "Data.Either3.Either3T" "either-n-0.1.0.0-CpOhhAwrwgx6b0mOF5Mcu" 'True) (C1 ('MetaCons "Either3T" 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f (Either3 a b c)))))Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • type Rep1 (Either3T f a b) = D1 ('MetaData "Either3T" "Data.Either3.Either3T" "either-n-0.1.0.0-CpOhhAwrwgx6b0mOF5Mcu" 'True) (C1 ('MetaCons "Either3T" 'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (f :.: Rec1 (Either3 a b))))Defined in either-n-0.1.0.0 · Data.Either3.Either3T
  • type Unwrapped (Either3T f a b c) = f (Either3 a b c)Defined in either-n-0.1.0.0 · Data.Either3.Either3T

Isomorphisms

6 declarations
valueeither3Identity
  1. :: (Profunctor p, Functor f)
  2. => p (Either3TIdentity a b c) (f (Either3TIdentity a' b' c'))
  3. -> p (Either3 a b c) (f (Either3 a' b' c'))
#

Either3 is isomorphic to Either3T over Identity.

Example1 expression
view either3Identity (Third3 1 :: Either3 String Bool Int)Either3T (Identity (Third3 1))
Example1 expression
review either3Identity (Either3T (Identity (Second3 True)) :: Either3TIdentity String Bool Int)Second3 True

It can change the type parameters:

Example1 expression
over either3Identity (fmap show) (Third3 1 :: Either3 String Bool Int)Third3 "1"

Type aliases

4 declarations

Optics

0 declarations

Classy lenses

classclass GetEither3T s f a b c => HasEither3T s (f :: Type -> Type) a b c | s -> f a b c where
#

Class for types that have a Lens' to an Either3T. Instances define setEither3T; the lens either3T follows from it and from getEither3T.

Example1 expression
setEither3T (Either3T [Third3 2]) (Either3T [Third3 1] :: Either3TList String Bool Int)Either3T [Third3 2]

Methods

Instances1HasEither3T

Classy prisms

classclass ReviewEither3T t f a b c => AsEither3T t (f :: Type -> Type) a b c | t -> f a b c where
#

Class for types that have a Prism' to an Either3T. Instances define matchEither3T; the prism _Either3T follows from it and from reviewEither3T.

Example1 expression
matchEither3T (Either3T [Third3 1] :: Either3TList String Bool Int)Just (Either3T [Third3 1])

Methods

Instances1AsEither3T