template-haskell-2.11.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)

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] -> Maybe Kind -> [ConQ] -> CxtQ -> DecQ Source

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

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

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

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

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

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

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

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

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

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

infixC :: Q (Bang, Type) -> Name -> Q (Bang, Type) -> ConQ 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.

isStrict :: Q Strict Source

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

notStrict :: Q Strict Source

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

unpacked :: Q Strict Source

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

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

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

varStrictType :: Name -> StrictTypeQ -> VarStrictTypeQ Source

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

Type Literals

Kind

Type family result

Injectivity annotation

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.