Safe Haskell | None |
---|
- type StackPrisms a = PrismList (Rep a) a
- mkPrismList :: (Generic a, MkPrismList (Rep a)) => StackPrisms a
- data family PrismList f a
- type family StackPrismLhs f t :: *
Documentation
type StackPrisms a = PrismList (Rep a) aSource
mkPrismList :: (Generic a, MkPrismList (Rep a)) => StackPrisms aSource
Derive a list of stack prisms, one for each constructor in the Generic
datatype a
. The list is wrapped in the unary constructor PrismList
. Within that constructor, the prisms are separated by the right-associative binary infix constructor :&
. Finally, the individual prisms are wrapped in the unary constructor I
. These constructors are all exported by this module, but no documentation is generated for them by Hackage.
As an example, here is how to define the prisms nil
and cons
for [a]
, which is an instance of Generic
:
nil :: StackPrism t ([a] :- t) cons :: StackPrism (a :- [a] :- t) ([a] :- t) PrismList (P nil :& P cons) = mkPrismList :: StackPrisms [a]
type family StackPrismLhs f t :: *Source