template-haskell-2.10.0.0: Support library for Template Haskell

Safe HaskellNone
LanguageHaskell2010

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 PatQ = Q Pat Source

type ExpQ = Q Exp Source

type TExpQ a = Q (TExp a) Source

type DecQ = Q Dec Source

type DecsQ = Q [Dec] Source

type ConQ = Q Con Source

type CxtQ = Q Cxt Source

Lowercase pattern syntax functions

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

Stmt

Range

Body

Guard

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

Match and Clause

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

Use with caseE

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

Use with funD

Exp

dyn :: String -> ExpQ Source

Dynamically binding a variable (unhygenic)

global :: Name -> ExpQ Source

Deprecated: Use varE instead

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

lam1E :: PatQ -> ExpQ -> ExpQ Source

Single-arg lambda

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

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

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

staticE :: ExpQ -> ExpQ Source

staticE x = [| static x |]

arithSeqE Shortcuts

Dec

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

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

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

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

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

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

Type

classP :: Name -> [Q Type] -> Q Pred Source

Deprecated: As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please use conT and appT.

equalP :: TypeQ -> TypeQ -> PredQ Source

Deprecated: As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please see equalityT.

Type Literals

Kind

Role

Callconv

Safety

FunDep

FamFlavour

RuleBndr

AnnTarget

Useful helper function

thisModule :: Q Module Source

Return the Module at the place of splicing. Can be used as an input for reifyModule.