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. Compatible with the lens package's
Control.Lens.Prismtype.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-lens-2.2.2.0 · Data.Generics.Sum.ConstructorsAsConstructor ctor (Void1 a) (Void1 b) a bDefined in generic-lens-2.2.2.0 · Data.Generics.Sum.ConstructorsUncluttering type signatures (see Void)
Example1 expression :t +d _Ctor_Ctor :: (AsConstructor ctor s t a b, Choice p, Applicative f) => p a (f b) -> p s (f t)