template-haskell-2.7.0.0

Safe HaskellNone

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 InfoQ = Q Info

type PatQ = Q Pat

type ExpQ = Q Exp

type DecQ = Q Dec

type DecsQ = Q [Dec]

type ConQ = Q Con

type TypeQ = Q Type

type CxtQ = Q Cxt

type PredQ = Q Pred

type MatchQ = Q Match

type BodyQ = Q Body

type GuardQ = Q Guard

type StmtQ = Q Stmt

type RangeQ = Q Range

Lowercase pattern syntax functions

charL :: Char -> Lit

litP :: Lit -> PatQ

varP :: Name -> PatQ

tupP :: [PatQ] -> PatQ

conP :: Name -> [PatQ] -> PatQ

infixP :: PatQ -> Name -> PatQ -> PatQ

uInfixP :: PatQ -> Name -> PatQ -> PatQ

asP :: Name -> PatQ -> PatQ

recP :: Name -> [FieldPatQ] -> PatQ

listP :: [PatQ] -> PatQ

sigP :: PatQ -> TypeQ -> PatQ

viewP :: ExpQ -> PatQ -> PatQ

Stmt

bindS :: PatQ -> ExpQ -> StmtQ

letS :: [DecQ] -> StmtQ

parS :: [[StmtQ]] -> StmtQ

Range

Body

guardedB :: [Q (Guard, Exp)] -> BodyQ

Guard

normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp)

patG :: [StmtQ] -> GuardQ

patGE :: [StmtQ] -> ExpQ -> Q (Guard, Exp)

Match and Clause

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

Use with caseE

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

Use with funD

Exp

dyn :: String -> Q Exp

Dynamically binding a variable (unhygenic)

varE :: Name -> ExpQ

conE :: Name -> ExpQ

litE :: Lit -> ExpQ

appE :: ExpQ -> ExpQ -> ExpQ

uInfixE :: ExpQ -> ExpQ -> ExpQ -> ExpQ

infixApp :: ExpQ -> ExpQ -> ExpQ -> ExpQ

lamE :: [PatQ] -> ExpQ -> ExpQ

lam1E :: PatQ -> ExpQ -> ExpQ

Single-arg lambda

tupE :: [ExpQ] -> ExpQ

condE :: ExpQ -> ExpQ -> ExpQ -> ExpQ

letE :: [DecQ] -> ExpQ -> ExpQ

caseE :: ExpQ -> [MatchQ] -> ExpQ

doE :: [StmtQ] -> ExpQ

compE :: [StmtQ] -> ExpQ

listE :: [ExpQ] -> ExpQ

sigE :: ExpQ -> TypeQ -> ExpQ

recConE :: Name -> [Q (Name, Exp)] -> ExpQ

recUpdE :: ExpQ -> [Q (Name, Exp)] -> ExpQ

fieldExp :: Name -> ExpQ -> Q (Name, Exp)

arithSeqE Shortcuts

Dec

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

funD :: Name -> [ClauseQ] -> DecQ

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

newtypeD :: CxtQ -> Name -> [TyVarBndr] -> ConQ -> [Name] -> DecQ

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

instanceD :: CxtQ -> TypeQ -> [DecQ] -> DecQ

sigD :: Name -> TypeQ -> DecQ

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

newtypeInstD :: CxtQ -> Name -> [TypeQ] -> ConQ -> [Name] -> DecQ

cxt :: [PredQ] -> CxtQ

classP :: Name -> [TypeQ] -> PredQ

infixC :: Q (Strict, Type) -> Name -> Q (Strict, Type) -> ConQ

Type

sigT :: TypeQ -> Kind -> TypeQ

Kind

arrowK :: Kind -> Kind -> Kind

Callconv

Safety

InlineSpec

FunDep

funDep :: [Name] -> [Name] -> FunDep

FamFlavour

Useful helper function

appsE :: [ExpQ] -> ExpQ