| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Pinchot.SyntaxTree.Instancer
- bifunctorInstances :: [Rule t] -> DecsQ
- semigroupInstances :: [Rule t] -> DecsQ
- monoidInstances :: [Rule t] -> DecsQ
- bimapExpression :: Qualifier -> Rule t -> ExpQ
- bimapLetBinds :: Qualifier -> Name -> Name -> Map RuleName Name -> Rule t -> Q [DecQ]
- bimapLetBind :: Qualifier -> Name -> Name -> Map RuleName Name -> Rule t -> Q DecQ
- terminalBimapLetBind :: Qualifier -> Name -> Name -> Map RuleName Name -> RuleName -> Q DecQ
- nonTerminalBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> [Branch a] -> DecQ
- wrapBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> RuleName -> Q DecQ
- recordBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> [Rule t] -> Q DecQ
- recordBimapClause :: Qualifier -> Map RuleName Name -> RuleName -> [Rule t] -> ClauseQ
- recordBimapLetBindField :: Map RuleName Name -> Rule t -> Q (PatQ, ExpQ)
- optBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> RuleName -> Q DecQ
- starBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> RuleName -> Q DecQ
- plusBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> RuleName -> Q DecQ
- seriesBimapLetBind :: Qualifier -> Name -> Name -> Map RuleName Name -> RuleName -> Q DecQ
- errLookup :: (Ord a, Show a) => a -> Map a b -> b
- nameMap :: Rule t -> Q (Map RuleName Name)
- memptyExpression :: Qualifier -> Rule t -> Maybe ExpQ
- wrappedMemptyExpression :: Qualifier -> [RuleName] -> ExpQ
- mappendExpression :: Qualifier -> Rule t -> Maybe ExpQ
- monoidCtors :: Rule t -> Maybe [RuleName]
- semigroupExpression :: Qualifier -> Rule t -> Maybe ExpQ
- semigroupCtors :: Rule t -> Maybe [RuleName]
- wrappedSemigroupExpression :: Name -> Qualifier -> [RuleName] -> ExpQ
- prettyExpression :: Qualifier -> Rule t -> ExpQ
- prettyInstance :: Rule t -> DecQ
- prettyInstanceFamily :: Rule t -> DecsQ
- prettyInstances :: [Rule t] -> DecsQ
- prettyExpressionInEnv :: Qualifier -> Map RuleName Name -> Rule t -> ExpQ
- prettyBranches :: Qualifier -> Map RuleName Name -> NonEmpty (Branch t) -> ExpQ
- lookupRule :: Map RuleName Name -> RuleName -> Q Name
- deconstruct :: Name -> Int -> ([ExpQ] -> ExpQ) -> Q (PatQ, ExpQ)
- prettyBranch :: Qualifier -> Map RuleName Name -> Branch t -> MatchQ
- prettyConstructor :: Qualifier -> Map RuleName Name -> String -> [Rule t] -> Q (PatQ, ExpQ)
Documentation
bifunctorInstances :: [Rule t] -> DecsQ Source #
Creates an instance of Bifunctor for every Rule
in the Seq as well as their ancestors.
This function must be spliced in the same module as the module in which the syntax tree types are created. This avoids problems with orphan instances. Since ancestors are included, you can get the entire tree of instances that you need by applying this function to a single start symbol.
Example: Pinchot.Examples.SyntaxTrees.
semigroupInstances :: [Rule t] -> DecsQ Source #
Where possible, creates an instance of Semigroup
for every Rule in the Seq as well as their ancestors. Only
star and plus rules, as well as rules that through one or
more layers of wrap ultimately wrap a star or plus rule,
get a Semigroup instance.
This function must be spliced in the same module as the module in which the syntax tree types are created. This avoids problems with orphan instances. Since ancestors are included, you can get the entire tree of instances that you need by applying this function to a single start symbol.
Example: Pinchot.Examples.SyntaxTrees.
monoidInstances :: [Rule t] -> DecsQ Source #
Where possible, creates an instance of Monoid
for every Rule in the Seq as well as their ancestors. Only
star rules, as well as rules that through one or
more layers of wrap ultimately wrap a star rule,
get a Monoid instance.
This function must be spliced in the same module as the module in which the syntax tree types are created. This avoids problems with orphan instances. Since ancestors are included, you can get the entire tree of instances that you need by applying this function to a single start symbol.
Example: Pinchot.Examples.SyntaxTrees.
terminalBimapLetBind :: Qualifier -> Name -> Name -> Map RuleName Name -> RuleName -> Q DecQ Source #
nonTerminalBimapLetBind :: Qualifier -> Map RuleName Name -> RuleName -> [Branch a] -> DecQ Source #
nameMap :: Rule t -> Q (Map RuleName Name) Source #
Creates a map of all ancestor rule names and a corresponding TH name.
mappendExpression :: Qualifier -> Rule t -> Maybe ExpQ Source #
If possible, creates an expression of type
RuleData -> RuleData -> RuleData
which is a Monoid mappend.
prettyExpression :: Qualifier -> Rule t -> ExpQ Source #
Creates an expression of type
RuleData -> Value
prettyInstance :: Rule t -> DecQ Source #
Creates a PrettyVal instance. This must be spliced into the same
module in which the corresponding data type is spliced.
prettyInstanceFamily :: Rule t -> DecsQ Source #
Creates a PrettyVal instance for a rule and all its
ancestors.
prettyInstances :: [Rule t] -> DecsQ Source #
Creates a PrettyVal instance for each Rule in the
Seq, as well as for all the ancestors of each Rule in the
Seq.
This function must be spliced in the same module as the module in which the syntax tree types are created. This avoids problems with orphan instances. Since ancestors are included, you can get the entire tree of instances that you need by applying this function to a single start symbol.
Example: Pinchot.Examples.SyntaxTrees.
prettyExpressionInEnv Source #
Creates an expression of type
RuleData -> Value