template-haskell-2.5.0.0

Language.Haskell.TH.Lib

Contents

Description

TH.Lib contains lots of useful helper functions for generating and manipulating Template Haskell terms

Synopsis

Type synonyms

type DecsQ = Q [Dec]Source

Lowercase pattern syntax functions

Stmt

Range

Body

Guard

Match and Clause

match :: PatQ -> BodyQ -> [DecQ] -> MatchQSource

Use with caseE

clause :: [PatQ] -> BodyQ -> [DecQ] -> ClauseQSource

Use with funD

Exp

dyn :: String -> Q ExpSource

Dynamically binding a variable (unhygenic)

lam1E :: PatQ -> ExpQ -> ExpQSource

Single-arg lambda

arithSeqE Shortcuts

Dec

valD :: PatQ -> BodyQ -> [DecQ] -> DecQSource

dataD :: CxtQ -> Name -> [TyVarBndr] -> [ConQ] -> [Name] -> DecQSource

classD :: CxtQ -> Name -> [TyVarBndr] -> [FunDep] -> [DecQ] -> DecQSource

dataInstD :: CxtQ -> Name -> [TypeQ] -> [ConQ] -> [Name] -> DecQSource

Type

Kind

Callconv

Safety

InlineSpec

FunDep

FamFlavour

Useful helper functions

combine :: [([(Name, Name)], Pat)] -> ([(Name, Name)], [Pat])Source

rename :: Pat -> Q ([(Name, Name)], Pat)Source

alpha :: [(Name, Name)] -> Name -> ExpQSource