Sums that have generic prisms.
Methods
_As :: Prism s s a aA prism that projects a sum as identified by some selector. Currently supported selectors are constructor names and unique types. Compatible with the lens package's
Control.Lens.Prismtype.Example1 expression dog ^? _As @"Dog"Just (MkDog {name = "Shep", age = 3})
Example1 expression dog ^? _As @DogJust (MkDog {name = "Shep", age = 3})
Example1 expression dog ^? _As @"Cat"Nothing
Example1 expression cat ^? _As @(Name, Age)Just ("Mog",5)
Example1 expression cat ^? _As @"Cat"Just ("Mog",5)
Example1 expression _As @"Cat" # ("Garfield", 6) :: AnimalCat "Garfield" 6
Example1 expression duck ^? _As @AgeJust 2
Instances2AsAny
AsConstructor ctor s s a a => AsAny ctor a sDefined in generic-lens-2.2.2.0 · Data.Generics.Sum.AnyAsType a s => AsAny a a sDefined in generic-lens-2.2.2.0 · Data.Generics.Sum.Any