Sums that have a constructor with a field of the given type.
Methods
_Typed :: Prism' s aA prism that projects a constructor uniquely identifiable by the type of its field. Compatible with the lens package's
Control.Lens.Prismtype.Example3 expressions dog ^? _Typed @DogJust (MkDog {name = "Shep", age = Age 3})cat ^? _Typed @(Name, Age)Just ("Mog",Age 5)dog ^? _Typed @Age......... The type Animal contains multiple constructors whose fields are of type Age.... The choice of constructor is thus ambiguous, could be any of:... Duck... Turtle...
injectTyped :: a -> sInject by type.
projectTyped :: s -> Maybe aProject by type.
Instances3AsType
AsType Void aDefined in generic-lens-2.2.2.0 · Data.Generics.Sum.TypedUncluttering type signatures (see Void)
Example1 expression :t +d _Typed @Int_Typed @Int :: (AsType Int s, Choice p, Applicative f) => p Int (f Int) -> p s (f s)
AsType a VoidDefined in generic-lens-2.2.2.0 · Data.Generics.Sum.TypedUncluttering type signatures (see Void)
Example1 expression :t +d _Typed_Typed :: (AsType a s, Choice p, Applicative f) => p a (f a) -> p s (f s)
Context a s => AsType a sDefined in generic-lens-2.2.2.0 · Data.Generics.Sum.Typed