Safe Haskell | None |
---|---|
Language | Haskell2010 |
- rulesToOptics :: Lift t => Qualifier -> Name -> Seq (Rule t) -> Q [Dec]
- ruleToOptics :: Lift t => Qualifier -> Name -> Rule t -> Q [Dec]
- terminalToOptics :: Lift t => Qualifier -> Name -> String -> Intervals t -> Q [Dec]
- nonTerminalToOptics :: Qualifier -> String -> Branch t -> Seq (Branch t) -> [Q Dec]
- recordsToOptics :: Qualifier -> String -> Seq (Rule t) -> [Q Dec]
- forallA :: TypeQ -> TypeQ
Documentation
:: Lift t | |
=> Qualifier | Qualifier for module containing the data types that will get optics |
-> Name | Type name for the terminal |
-> Seq (Rule t) | |
-> Q [Dec] |
Creates optics declarations for a Rule
, if optics can
be made for the Rule
:
terminal
gets a singlePrism
nonTerminal
gets aPrism
for each constructorrecord
gets a singleLens
wrap
,opt
,star
, andplus
do not get optics.
Each rule in the sequence of Rule
, as well as all ancestors of
those Rule
s, will be handled.
Example: Pinchot.Examples.RulesToOptics.
:: Lift t | |
=> Qualifier | Qualifier for module containing the data type that will get optics |
-> Name | Terminal type name |
-> String | Rule name |
-> Intervals t | |
-> Q [Dec] |
Creates a prism for a terminal type. Although a newtype wraps each terminal, do not make a Wrapped or an Iso, because the relationship between the outer type and the type that it wraps typically is not isometric. Thus, use a Prism instead, which captures this relationship properly.
:: Qualifier | Qualifier for module containing the data type that will get optics |
-> String | Rule name |
-> Branch t | |
-> Seq (Branch t) | |
-> [Q Dec] |
Creates prisms for each Branch
.