| 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.Product.Subtype
Contents
Description
Structural subtype relationships between product types.
- class Subtype sup sub where
Lenses
class Subtype sup sub where Source #
Structural subtype relationship
sub is a (structural) subtype of sup, if its fields are a subset of
 those of sup.
Methods
super :: Lens' sub sup Source #
Structural subtype lens. Given a subtype relationship sub :< sup,
  we can focus on the sub structure of sup.
>>>human ^. super @AnimalAnimal {name = "Tunyasz", age = 50}
>>>set (super @Animal) (Animal "dog" 10) humanHuman {name = "dog", age = 10, address = "London"}
Cast the more specific subtype to the more general supertype
>>>upcast human :: AnimalAnimal {name = "Tunyasz", age = 50}
smash :: sup -> sub -> sub Source #
Plug a smaller structure into a larger one
>>>smash (Animal "dog" 10) humanHuman {name = "dog", age = 10, address = "London"}