| Copyright | (C) 2017 Csongor Kiss | 
|---|---|
| License | BSD3 | 
| Maintainer | Csongor Kiss <kiss.csongor.kiss@gmail.com> | 
| Stability | experimental | 
| Portability | non-portable | 
| Safe Haskell | Safe | 
| Language | Haskell2010 | 
Data.Generics.Sum.Typed
Contents
Description
Derive constructor-field-type-based prisms generically.
- class AsType a s where
Prisms
class AsType a s where Source #
Sums that have a constructor with a field of the given type.
Minimal complete definition
Methods
A prism that projects a constructor uniquely identifiable by the type of
  its field. Compatible with the lens package's Prism type.
>>>dog ^? _Typed @DogJust (MkDog {name = "Shep", age = 3})>>>dog ^? _Typed @AgeNothing>>>cat ^? _Typed @(Name, Age)Just ("Mog",5)>>>duck ^? _Typed @AgeJust 2
injectTyped :: a -> s Source #
Inject by type.
projectTyped :: s -> Maybe a Source #
Project by type.