Sums that have a constructor with a given name.
Methods
_Ctor :: Prism s t a bA prism that projects a named constructor from a sum.
Example1 expression dog ^? _Ctor @"Dog"Just (MkDog {name = "Shep", age = 3, fieldA = 30})
Example1 expression dog ^? _Ctor @"Cat"Nothing
Example1 expression cat ^? _Ctor @"Cat"Just ("Mog",5)
Example1 expression _Ctor @"Cat" # ("Garfield", 6) :: Animal IntCat "Garfield" 6
Type errors
Example1 expression cat ^? _Ctor @"Turtle"......... The type Animal Int does not contain a constructor named "Turtle"...
Instances2AsConstructor
(Context ctor s t a b, AsConstructor0 ctor s t a b) => AsConstructor ctor s t a bDefined in generic-optics-2.2.1.0 · Data.Generics.Sum.ConstructorsAsConstructor ctor (Void1 a) (Void1 b) a bDefined in generic-optics-2.2.1.0 · Data.Generics.Sum.ConstructorsSee Note [Uncluttering type signatures] >>> :t _Ctor _Ctor :: AsConstructor ctor s t a b => Prism s t a b