Lucu-1.0: Embedded HTTP Server

Network.HTTP.Lucu.Implant.Rewrite

Description

An internal module for rewriting Names in Template Haskell AST.

Synopsis

Documentation

data NamePat Source

Pattern for Names. Just represents a perfect matching pattern, and Nothing represensts a wildcard.

Constructors

NamePat !(Maybe ModName) !(Maybe OccName) 

data RewriteOp Source

Instruction for rewriting Names.

data Imports Source

A Set of modules and names to be imported.

Instances

Monoid Imports 
Collection Imports ImportOp 
Unfoldable Imports ImportOp

insert imp merges imp with an existing one if any.

Foldable Imports ImportOp 
Set Imports ImportOp 
SortingCollection Imports ImportOp 
Map Imports ImportOp () 

data ImportOp Source

Instruction for declaring module imports.

Constructors

QualifiedImp
 import qualified M as A
UnqualifiedImp
 import M

or

 import M (a, b, c, ...)

Instances

Eq ImportOp 
Ord ImportOp 
Collection Imports ImportOp 
Unfoldable Imports ImportOp

insert imp merges imp with an existing one if any.

Foldable Imports ImportOp 
Set Imports ImportOp 
SortingCollection Imports ImportOp 
Map Imports ImportOp () 

data RewriteRule Source

Instruction for rewriting Names and declaring module imports.

Constructors

RewriteRule 

Fields

rrPat :: !NamePat
 
rrOp :: !RewriteOp
 
rrImps :: !Imports
 

qualifyAll :: String -> String -> RewriteRuleSource

qualifyAll module alias: qualify every symbols defined in module with alias.

unqualify :: Name -> String -> RewriteRuleSource

unqualify name module: unqualify the symbol name with importing module.

unqualifyIn :: Name -> Name -> String -> RewriteRuleSource

unqualifyIn name tycl module: unqualify a constructor, field name, or whatever resides in the type or class tycl with importing module.

unqualifyAll :: String -> String -> RewriteRuleSource

unqualifyAll origMod impMod: unqualify every symbols defined in origMod with importing impMod.

rewriteNames :: Data d => Rules -> d -> (d, Imports)Source

rewriteNames rules d rewrites each and every Names included in d according to the name-rewriting rules while at the same time building a set of modules to be imported.