HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleeither-n-0.1.0.0Haskell2010

Data.Lens.Injection.Injection8

The eighth injection of a sum type, as a prism. The sum-type dual of Control.Lens.Field8.

Synopsis
  • Packageeither-n-0.1.0.0
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInjection8.hs
classclass Injection8 s t a b | s -> a, t -> b, s b -> t, t a -> s where

Access the eighth constructor of a sum type.

Where Control.Lens._8 is the eighth projection out of a product, _I8 is the eighth injection into a sum.

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

Example3 expressions
data T = C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8 Int | C9 deriving (Show, Generic)instance Injection8 T T Int IntC8 1 ^? _I8Just 1
Example1 expression
C9 ^? _I8Nothing
Example1 expression
_I8 # 1 :: TC8 1

Methods