An internal module for rewriting Name
s in Template Haskell AST.
- data NamePat = NamePat !(Maybe ModName) !(Maybe OccName)
- data RewriteOp
- data Imports
- data ImportOp
- type Rules = [RewriteRule]
- data RewriteRule = RewriteRule {}
- qualifyAll :: String -> String -> RewriteRule
- unqualify :: Name -> String -> RewriteRule
- unqualifyIn :: Name -> Name -> String -> RewriteRule
- unqualifyAll :: String -> String -> RewriteRule
- rewriteNames :: Data d => Rules -> d -> (d, Imports)
Documentation
A Set
of modules and names to be imported.
Instruction for declaring module imports.
QualifiedImp | import qualified M as A |
UnqualifiedImp | import M or import M (a, b, c, ...) |
type Rules = [RewriteRule]Source
List of RewriteRule
s.
data RewriteRule Source
Instruction for rewriting Name
s and declaring module imports.
qualifyAll :: String -> String -> RewriteRuleSource
: qualify every symbols defined in
qualifyAll
module aliasmodule
with alias
.
unqualify :: Name -> String -> RewriteRuleSource
: unqualify the symbol unqualify
name modulename
with
importing module
.
unqualifyIn :: Name -> Name -> String -> RewriteRuleSource
: unqualify a constructor, field
name, or whatever resides in the type or class unqualifyIn
name tycl moduletycl
with
importing module
.
unqualifyAll :: String -> String -> RewriteRuleSource
: unqualify every symbols
defined in unqualifyAll
origMod impModorigMod
with importing impMod
.
rewriteNames :: Data d => Rules -> d -> (d, Imports)Source
rewrites each and every rewriteNames
rules dName
s included
in d
according to the name-rewriting rules
while at the same
time building a set of modules to be imported.