template-haskell-2.11.1.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 InfoQ = Q Info #

type PatQ = Q Pat #

type ExpQ = Q Exp #

type TExpQ a = Q (TExp a) #

type DecQ = Q Dec #

type DecsQ = Q [Dec] #

type ConQ = Q Con #

type TypeQ = Q Type #

type TyLitQ = Q TyLit #

type CxtQ = Q Cxt #

type PredQ = Q Pred #

type MatchQ = Q Match #

type ClauseQ = Q Clause #

type BodyQ = Q Body #

type GuardQ = Q Guard #

type StmtQ = Q Stmt #

type RangeQ = Q Range #

type BangQ = Q Bang #

type Role = Role #

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 -> ExpQ #

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 #

multiIfE :: [Q (Guard, Exp)] -> 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) #

staticE :: ExpQ -> ExpQ #

staticE x = [| static x |]

arithSeqE Shortcuts

Dec

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

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

dataD :: CxtQ -> Name -> [TyVarBndr] -> Maybe Kind -> [ConQ] -> CxtQ -> DecQ #

newtypeD :: CxtQ -> Name -> [TyVarBndr] -> Maybe Kind -> ConQ -> CxtQ -> DecQ #

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

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

sigD :: Name -> TypeQ -> DecQ #

infixLD :: Int -> Name -> DecQ #

infixRD :: Int -> Name -> DecQ #

infixND :: Int -> Name -> DecQ #

dataInstD :: CxtQ -> Name -> [TypeQ] -> Maybe Kind -> [ConQ] -> CxtQ -> DecQ #

newtypeInstD :: CxtQ -> Name -> [TypeQ] -> Maybe Kind -> ConQ -> CxtQ -> DecQ #

familyNoKindD :: FamFlavour -> Name -> [TyVarBndr] -> DecQ #

Deprecated: This function will be removed in the next stable release. Use openTypeFamilyD/dataFamilyD instead.

familyKindD :: FamFlavour -> Name -> [TyVarBndr] -> Kind -> DecQ #

Deprecated: This function will be removed in the next stable release. Use openTypeFamilyD/dataFamilyD instead.

closedTypeFamilyNoKindD :: Name -> [TyVarBndr] -> [TySynEqnQ] -> DecQ #

Deprecated: This function will be removed in the next stable release. Use closedTypeFamilyD instead.

closedTypeFamilyKindD :: Name -> [TyVarBndr] -> Kind -> [TySynEqnQ] -> DecQ #

Deprecated: This function will be removed in the next stable release. Use closedTypeFamilyD instead.

cxt :: [PredQ] -> CxtQ #

infixC :: Q (Bang, Type) -> Name -> Q (Bang, Type) -> ConQ #

gadtC :: [Name] -> [StrictTypeQ] -> TypeQ -> ConQ #

Type

sigT :: TypeQ -> Kind -> TypeQ #

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

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 #

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

isStrict :: Q Strict #

Deprecated: Use bang. See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0. Example usage: 'bang noSourceUnpackedness sourceStrict'

notStrict :: Q Strict #

Deprecated: Use bang. See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0. Example usage: 'bang noSourceUnpackedness noSourceStrictness'

unpacked :: Q Strict #

Deprecated: Use bang. See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0. Example usage: 'bang sourceUnpack sourceStrict'

strictType :: Q Strict -> TypeQ -> StrictTypeQ #

Deprecated: As of template-haskell-2.11.0.0, StrictType has been replaced by BangType. Please use bangType instead.

varStrictType :: Name -> StrictTypeQ -> VarStrictTypeQ #

Deprecated: As of template-haskell-2.11.0.0, VarStrictType has been replaced by VarBangType. Please use varBangType instead.

Type Literals

Kind

varK :: Name -> Kind #

conK :: Name -> Kind #

appK :: Kind -> Kind -> Kind #

Type family result

Injectivity annotation

Role

Callconv

Safety

FunDep

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

FamFlavour

RuleBndr

AnnTarget

Useful helper function

appsE :: [ExpQ] -> ExpQ #

thisModule :: Q Module #

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