| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Pinchot.SyntaxTree.Optics
- 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
Arguments
| :: 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:
terminalgets a singlePrismnonTerminalgets aPrismfor each constructorrecordgets a singleLenswrap,opt,star, andplusdo not get optics.
Each rule in the sequence of Rule, as well as all ancestors of
those Rules, will be handled.
Example: Pinchot.Examples.RulesToOptics.
Arguments
| :: 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.
Arguments
| :: 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.