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.Lens.Injection.Injection3

The third injection of a sum type, as a prism. The sum-type dual of Control.Lens.Field3.

  • 1 class
  • Packageeither-n-0.1.0.0
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInjection3.hs
classclass Injection3 s t a b | s -> a, t -> b, s b -> t, t a -> s where
#

Access the third constructor of a sum type.

Where Control.Lens._3 is the third projection out of a product, _I3 is the third injection into a sum.

The default implementation is the prism to the third constructor of a Generic type, injection (Proxy :: Proxy 2).

Example3 expressions
data T = C1 | C2 | C3 Int | C4 deriving (Show, Generic)instance Injection3 T T Int IntC3 1 ^? _I3Just 1
Example1 expression
C4 ^? _I3Nothing
Example1 expression
_I3 # 1 :: TC3 1

Methods

Instances3Injection3
  • Injection3 Ordering Ordering () ()Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection3
    Example1 expression
    GT ^? _I3Just ()
    Example1 expression
    LT ^? _I3Nothing
    Example1 expression
    EQ ^? _I3Nothing
    Example1 expression
    _I3 # () :: OrderingGT
  • Injection3 (Either3 a b c) (Either3 a b c') c c'Defined in either-n-0.1.0.0 · Data.Either3.Either3
    Example1 expression
    (Third3 "x" :: Either3 Int Bool String) ^? _I3Just "x"
    Example1 expression
    (First3 1 :: Either3 Int Bool String) ^? _I3Nothing
  • 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