ghc-internal-9.1300.0: Basic libraries
Safe HaskellTrustworthy
LanguageHaskell2010

GHC.Internal.TH.Lib

Description

GHC.Internal.TH.Lib exposes some additional functionality that is used internally in GHC's integration with Template Haskell. This is not a part of the public API, and as such, there are no API guarantees for this module from version to version.

Synopsis

Type synonyms

type TExpQ (a :: TYPE r) = Q (TExp a) Source #

Representation-polymorphic since template-haskell-2.17.0.0.

type PatQ = Q Pat Source #

type ExpQ = Q Exp Source #

type DecQ = Q Dec Source #

type DecsQ = Q [Dec] Source #

type Decs = [Dec] Source #

type ConQ = Q Con Source #

type CxtQ = Q Cxt Source #

type Role = Role Source #

Lowercase pattern syntax functions

litP :: Quote m => Lit -> m Pat Source #

varP :: Quote m => Name -> m Pat Source #

tupP :: Quote m => [m Pat] -> m Pat Source #

unboxedTupP :: Quote m => [m Pat] -> m Pat Source #

conP :: Quote m => Name -> [m Type] -> [m Pat] -> m Pat Source #

infixP :: Quote m => m Pat -> Name -> m Pat -> m Pat Source #

uInfixP :: Quote m => m Pat -> Name -> m Pat -> m Pat Source #

parensP :: Quote m => m Pat -> m Pat Source #

tildeP :: Quote m => m Pat -> m Pat Source #

bangP :: Quote m => m Pat -> m Pat Source #

asP :: Quote m => Name -> m Pat -> m Pat Source #

wildP :: Quote m => m Pat Source #

recP :: Quote m => Name -> [m FieldPat] -> m Pat Source #

listP :: Quote m => [m Pat] -> m Pat Source #

sigP :: Quote m => m Pat -> m Type -> m Pat Source #

typeP :: Quote m => m Type -> m Pat Source #

invisP :: Quote m => m Type -> m Pat Source #

viewP :: Quote m => m Exp -> m Pat -> m Pat Source #

orP :: Quote m => NonEmpty (m Pat) -> m Pat Source #

fieldPat :: Quote m => Name -> m Pat -> m FieldPat Source #

Stmt

bindS :: Quote m => m Pat -> m Exp -> m Stmt Source #

letS :: Quote m => [m Dec] -> m Stmt Source #

noBindS :: Quote m => m Exp -> m Stmt Source #

parS :: Quote m => [[m Stmt]] -> m Stmt Source #

recS :: Quote m => [m Stmt] -> m Stmt Source #

Range

fromR :: Quote m => m Exp -> m Range Source #

fromThenR :: Quote m => m Exp -> m Exp -> m Range Source #

fromToR :: Quote m => m Exp -> m Exp -> m Range Source #

fromThenToR :: Quote m => m Exp -> m Exp -> m Exp -> m Range Source #

Body

normalB :: Quote m => m Exp -> m Body Source #

guardedB :: Quote m => [m (Guard, Exp)] -> m Body Source #

Guard

normalG :: Quote m => m Exp -> m Guard Source #

normalGE :: Quote m => m Exp -> m Exp -> m (Guard, Exp) Source #

patG :: Quote m => [m Stmt] -> m Guard Source #

patGE :: Quote m => [m Stmt] -> m Exp -> m (Guard, Exp) Source #

Match and Clause

match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match Source #

Use with caseE

clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause Source #

Use with funD

Exp

dyn :: Quote m => String -> m Exp Source #

Dynamically binding a variable (unhygienic)

varE :: Quote m => Name -> m Exp Source #

conE :: Quote m => Name -> m Exp Source #

litE :: Quote m => Lit -> m Exp Source #

appE :: Quote m => m Exp -> m Exp -> m Exp Source #

appTypeE :: Quote m => m Exp -> m Type -> m Exp Source #

parensE :: Quote m => m Exp -> m Exp Source #

uInfixE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp Source #

infixE :: Quote m => Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp Source #

infixApp :: Quote m => m Exp -> m Exp -> m Exp -> m Exp Source #

sectionL :: Quote m => m Exp -> m Exp -> m Exp Source #

sectionR :: Quote m => m Exp -> m Exp -> m Exp Source #

lamE :: Quote m => [m Pat] -> m Exp -> m Exp Source #

lam1E :: Quote m => m Pat -> m Exp -> m Exp Source #

Single-arg lambda

lamCaseE :: Quote m => [m Match] -> m Exp Source #

Lambda-case (case)

lamCasesE :: Quote m => [m Clause] -> m Exp Source #

Lambda-cases (cases)

tupE :: Quote m => [Maybe (m Exp)] -> m Exp Source #

unboxedTupE :: Quote m => [Maybe (m Exp)] -> m Exp Source #

condE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp Source #

multiIfE :: Quote m => [m (Guard, Exp)] -> m Exp Source #

letE :: Quote m => [m Dec] -> m Exp -> m Exp Source #

caseE :: Quote m => m Exp -> [m Match] -> m Exp Source #

doE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp Source #

mdoE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp Source #

compE :: Quote m => [m Stmt] -> m Exp Source #

arithSeqE :: Quote m => m Range -> m Exp Source #

listE :: Quote m => [m Exp] -> m Exp Source #

sigE :: Quote m => m Exp -> m Type -> m Exp Source #

recConE :: Quote m => Name -> [m (Name, Exp)] -> m Exp Source #

recUpdE :: Quote m => m Exp -> [m (Name, Exp)] -> m Exp Source #

fieldExp :: Quote m => Name -> m Exp -> m (Name, Exp) Source #

staticE :: Quote m => m Exp -> m Exp Source #

staticE x = [| static x |]

labelE :: Quote m => String -> m Exp Source #

getFieldE :: Quote m => m Exp -> String -> m Exp Source #

typedSpliceE :: Quote m => m Exp -> m Exp Source #

arithSeqE Shortcuts

fromE :: Quote m => m Exp -> m Exp Source #

fromThenE :: Quote m => m Exp -> m Exp -> m Exp Source #

fromToE :: Quote m => m Exp -> m Exp -> m Exp Source #

fromThenToE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp Source #

typeE :: Quote m => m Type -> m Exp Source #

forallE :: Quote m => [m (TyVarBndr Specificity)] -> m Exp -> m Exp Source #

forallVisE :: Quote m => [m (TyVarBndr ())] -> m Exp -> m Exp Source #

constrainedE :: Quote m => [m Exp] -> m Exp -> m Exp Source #

Dec

valD :: Quote m => m Pat -> m Body -> [m Dec] -> m Dec Source #

funD :: Quote m => Name -> [m Clause] -> m Dec Source #

tySynD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> m Type -> m Dec Source #

dataD :: Quote m => m Cxt -> Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> [m Con] -> [m DerivClause] -> m Dec Source #

newtypeD :: Quote m => m Cxt -> Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> m Con -> [m DerivClause] -> m Dec Source #

typeDataD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> [m Con] -> m Dec Source #

classD :: Quote m => m Cxt -> Name -> [m (TyVarBndr BndrVis)] -> [FunDep] -> [m Dec] -> m Dec Source #

instanceD :: Quote m => m Cxt -> m Type -> [m Dec] -> m Dec Source #

instanceWithOverlapD :: Quote m => Maybe Overlap -> m Cxt -> m Type -> [m Dec] -> m Dec Source #

sigD :: Quote m => Name -> m Type -> m Dec Source #

kiSigD :: Quote m => Name -> m Kind -> m Dec Source #

forImpD :: Quote m => Callconv -> Safety -> String -> Name -> m Type -> m Dec Source #

infixLD :: Quote m => Int -> Name -> m Dec Source #

infixRD :: Quote m => Int -> Name -> m Dec Source #

infixND :: Quote m => Int -> Name -> m Dec Source #

defaultD :: Quote m => [m Type] -> m Dec Source #

pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec Source #

pragSpecInlD :: Quote m => Name -> m Type -> Inline -> Phases -> m Dec Source #

pragRuleD :: Quote m => String -> Maybe [m (TyVarBndr ())] -> [m RuleBndr] -> m Exp -> m Exp -> Phases -> m Dec Source #

pragAnnD :: Quote m => AnnTarget -> m Exp -> m Dec Source #

pragLineD :: Quote m => Int -> String -> m Dec Source #

dataInstD :: Quote m => m Cxt -> Maybe [m (TyVarBndr ())] -> m Type -> Maybe (m Kind) -> [m Con] -> [m DerivClause] -> m Dec Source #

newtypeInstD :: Quote m => m Cxt -> Maybe [m (TyVarBndr ())] -> m Type -> Maybe (m Kind) -> m Con -> [m DerivClause] -> m Dec Source #

dataFamilyD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> m Dec Source #

roleAnnotD :: Quote m => Name -> [Role] -> m Dec Source #

standaloneDerivD :: Quote m => m Cxt -> m Type -> m Dec Source #

defaultSigD :: Quote m => Name -> m Type -> m Dec Source #

patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec Source #

Pattern synonym declaration

patSynSigD :: Quote m => Name -> m Type -> m Dec Source #

Pattern synonym type signature

implicitParamBindD :: Quote m => String -> m Exp -> m Dec Source #

Implicit parameter binding declaration. Can only be used in let and where clauses which consist entirely of implicit bindings.

tySynEqn :: Quote m => Maybe [m (TyVarBndr ())] -> m Type -> m Type -> m TySynEqn Source #

cxt :: Quote m => [m Pred] -> m Cxt Source #

normalC :: Quote m => Name -> [m BangType] -> m Con Source #

recC :: Quote m => Name -> [m VarBangType] -> m Con Source #

infixC :: Quote m => m (Bang, Type) -> Name -> m (Bang, Type) -> m Con Source #

forallC :: Quote m => [m (TyVarBndr Specificity)] -> m Cxt -> m Con -> m Con Source #

gadtC :: Quote m => [Name] -> [m StrictType] -> m Type -> m Con Source #

recGadtC :: Quote m => [Name] -> [m VarStrictType] -> m Type -> m Con Source #

Type

forallT :: Quote m => [m (TyVarBndr Specificity)] -> m Cxt -> m Type -> m Type Source #

forallVisT :: Quote m => [m (TyVarBndr ())] -> m Type -> m Type Source #

varT :: Quote m => Name -> m Type Source #

conT :: Quote m => Name -> m Type Source #

infixT :: Quote m => m Type -> Name -> m Type -> m Type Source #

uInfixT :: Quote m => m Type -> Name -> m Type -> m Type Source #

promotedInfixT :: Quote m => m Type -> Name -> m Type -> m Type Source #

promotedUInfixT :: Quote m => m Type -> Name -> m Type -> m Type Source #

parensT :: Quote m => m Type -> m Type Source #

appT :: Quote m => m Type -> m Type -> m Type Source #

appKindT :: Quote m => m Type -> m Kind -> m Type Source #

listT :: Quote m => m Type Source #

litT :: Quote m => m TyLit -> m Type Source #

tupleT :: Quote m => Int -> m Type Source #

sigT :: Quote m => m Type -> m Kind -> m Type Source #

classP :: Quote m => Name -> [m Type] -> m 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 :: Quote m => m Type -> m Type -> m Pred Source #

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

isStrict :: Quote m => m Strict Source #

Deprecated: Use bang. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example usage: 'bang noSourceUnpackedness sourceStrict'

notStrict :: Quote m => m Strict Source #

Deprecated: Use bang. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example usage: 'bang noSourceUnpackedness noSourceStrictness'

unpacked :: Quote m => m Strict Source #

Deprecated: Use bang. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example usage: 'bang sourceUnpack sourceStrict'

bangType :: Quote m => m Bang -> m Type -> m BangType Source #

strictType :: Quote m => m Strict -> m Type -> m StrictType Source #

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

varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType Source #

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

Type Literals

Kind

plainTV :: Quote m => Name -> m (TyVarBndr ()) Source #

kindedTV :: Quote m => Name -> m Kind -> m (TyVarBndr ()) Source #

starK :: Quote m => m Kind Source #

Type family result

Injectivity annotation

Role

Callconv

Safety

FunDep

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

RuleBndr

AnnTarget

Pattern Synonyms (sub constructs)

Useful helper function

appsE :: Quote m => [m Exp] -> m Exp Source #

thisModule :: Q Module Source #

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

Documentation combinators

withDecDoc :: String -> Q Dec -> Q Dec Source #

Attaches Haddock documentation to the declaration provided. Unlike putDoc, the names do not need to be in scope when calling this function so it can be used for quoted declarations and anything else currently being spliced. Not all declarations can have documentation attached to them. For those that can't, withDecDoc will return it unchanged without any side effects.

withDecsDoc :: String -> Q [Dec] -> Q [Dec] Source #

Variant of withDecDoc that applies the same documentation to multiple declarations. Useful for documenting quoted declarations.

funD_doc Source #

Arguments

:: Name 
-> [Q Clause] 
-> Maybe String

Documentation to attach to function

-> [Maybe String]

Documentation to attach to arguments

-> Q Dec 

Variant of funD that attaches Haddock documentation.

dataD_doc Source #

Arguments

:: Q Cxt 
-> Name 
-> [Q (TyVarBndr BndrVis)] 
-> Maybe (Q Kind) 
-> [(Q Con, Maybe String, [Maybe String])]

List of constructors, documentation for the constructor, and documentation for the arguments

-> [Q DerivClause] 
-> Maybe String

Documentation to attach to the data declaration

-> Q Dec 

Variant of dataD that attaches Haddock documentation.

newtypeD_doc Source #

Arguments

:: Q Cxt 
-> Name 
-> [Q (TyVarBndr BndrVis)] 
-> Maybe (Q Kind) 
-> (Q Con, Maybe String, [Maybe String])

The constructor, documentation for the constructor, and documentation for the arguments

-> [Q DerivClause] 
-> Maybe String

Documentation to attach to the newtype declaration

-> Q Dec 

Variant of newtypeD that attaches Haddock documentation.

typeDataD_doc Source #

Arguments

:: Name 
-> [Q (TyVarBndr BndrVis)] 
-> Maybe (Q Kind) 
-> [(Q Con, Maybe String, [Maybe String])]

List of constructors, documentation for the constructor, and documentation for the arguments

-> Maybe String

Documentation to attach to the data declaration

-> Q Dec 

Variant of typeDataD that attaches Haddock documentation.

dataInstD_doc Source #

Arguments

:: Q Cxt 
-> Maybe [Q (TyVarBndr ())] 
-> Q Type 
-> Maybe (Q Kind) 
-> [(Q Con, Maybe String, [Maybe String])]

List of constructors, documentation for the constructor, and documentation for the arguments

-> [Q DerivClause] 
-> Maybe String

Documentation to attach to the instance declaration

-> Q Dec 

Variant of dataInstD that attaches Haddock documentation.

newtypeInstD_doc Source #

Arguments

:: Q Cxt 
-> Maybe [Q (TyVarBndr ())] 
-> Q Type 
-> Maybe (Q Kind) 
-> (Q Con, Maybe String, [Maybe String])

The constructor, documentation for the constructor, and documentation for the arguments

-> [Q DerivClause] 
-> Maybe String

Documentation to attach to the instance declaration

-> Q Dec 

Variant of newtypeInstD that attaches Haddock documentation.

patSynD_doc Source #

Arguments

:: Name 
-> Q PatSynArgs 
-> Q PatSynDir 
-> Q Pat 
-> Maybe String

Documentation to attach to the pattern synonym

-> [Maybe String]

Documentation to attach to the pattern arguments

-> Q Dec 

Variant of patSynD that attaches Haddock documentation.

docCons :: (Q Con, Maybe String, [Maybe String]) -> Q () Source #

Document a data/newtype constructor with its arguments.