Access the first constructor of a sum type.
Where Control.Lens._1 is the first projection out of a product, _I1 is the first
injection into a sum.
The default implementation is the prism to the first constructor of a
Generic type, injection (Proxy :: Proxy 0).
data T = C1 Int | C2 deriving (Show, Generic)instance Injection1 T T Int IntC1 1 ^? _I1Just 1
C2 ^? _I1Nothing
_I1 # 1 :: TC1 1
Instances11Injection1, …
Injection1 Bool Bool () ()Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1Example1 expression False ^? _I1Just ()
Example1 expression True ^? _I1Nothing
Example1 expression _I1 # () :: BoolFalse
Injection1 Ordering Ordering () ()Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1Example1 expression LT ^? _I1Just ()
Example1 expression EQ ^? _I1Nothing
Example1 expression GT ^? _I1Nothing
Example1 expression _I1 # () :: OrderingLT
Injection1 () () () ()Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1A sum of one nullary constructor, so _I1 always matches.
Example1 expression () ^? _I1Just ()
Example1 expression _I1 # () :: ()()
Injection1 (Identity a) (Identity b) a bDefined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1A sum of one constructor, so _I1 always matches.
Example1 expression Identity 1 ^? _I1Just 1
Example1 expression _I1 # 1 :: Identity IntIdentity 1
Example1 expression over _I1 show (Identity 1)Identity "1"
Injection1 (Maybe a) (Maybe a) () ()Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1Example1 expression (Nothing :: Maybe Int) ^? _I1Just ()
Example1 expression Just 1 ^? _I1Nothing
Example1 expression _I1 # () :: Maybe IntNothing
Injection1 [a] [a] () ()Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1A list is the sum of the empty list and a cons cell.
Example1 expression ([] :: [Int]) ^? _I1Just ()
Example1 expression [1, 2, 3] ^? _I1Nothing
Example1 expression _I1 # () :: [Int][]
Injection1 (Either a c) (Either b c) a bDefined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1Example1 expression (Left 1 :: Either Int String) ^? _I1Just 1
Example1 expression (Right "x" :: Either Int String) ^? _I1Nothing
Example1 expression _I1 # 1 :: Either Int StringLeft 1
Example1 expression over _I1 show (Left 1 :: Either Int Bool)Left "1"
Injection1 (Either3 a b c) (Either3 a' b c) a a'Defined in either-n-0.1.0.0 · Data.Either3.Either3Example1 expression (First3 1 :: Either3 Int Bool String) ^? _I1Just 1
Example1 expression over _I1 show (First3 1 :: Either3 Int Bool String)First3 "1"
Injection1 (Either3T Identity a b c) (Either3T Identity a' b c) a a'Defined in either-n-0.1.0.0 · Data.Either3.Either3TExample1 expression e3 (First3 "x") ^? _I1Just "x"
Injection1 (Sum f g a) (Sum f' g a) (f a) (f' a)Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1Example1 expression (InL (Just 1) :: Sum Maybe [] Int) ^? _I1Just (Just 1)
Example1 expression (InR [1] :: Sum Maybe [] Int) ^? _I1Nothing
Example1 expression _I1 # Just 1 :: Sum Maybe [] IntInL (Just 1)
Injection1 ((:+:) f g p) ((:+:) f' g p) (f p) (f' p)Defined in either-n-0.1.0.0 · Data.Lens.Injection.Injection1Example1 expression (L1 (Just 1) :: (Maybe :+: []) Int) ^? _I1Just (Just 1)
Example1 expression (R1 [1] :: (Maybe :+: []) Int) ^? _I1Nothing
Example1 expression _I1 # Just 1 :: (Maybe :+: []) IntL1 (Just 1)