Moduletemplate-haskell-2.25.0.0Haskell2010
Language.Haskell.TH.Lib
Language.Haskell.TH.Lib contains lots of useful helper functions for generating and manipulating Template Haskell terms
Contents
- Library functions
- Abbreviations
- Constructors lifted to Q
- Literals
- Patterns
- Pattern Guards
- Expressions
- Ranges
- Ranges with more indirection
- Statements
- Types
- Type literals
- Strictness
- Class Contexts
- Constructors
- Kinds
- Type variable binders
- Roles
- Top Level Declarations
- Data
- Class
- Role annotations
- Type Family / Data Family
- Fixity
- Default declaration
- Foreign Function Interface (FFI)
- Functional dependencies
- Pragmas
- Pattern Synonyms
- Implicit Parameters
- Reify
- Documentation
Synopsis
- type InfoQ
- type ExpQ
- type TExpQ
- type CodeQ
- type DecQ
- type DecsQ
- type ConQ
- type TypeQ
- type KindQ
- type TyLitQ
- type CxtQ
- type PredQ
- type DerivClauseQ
- type MatchQ
- type ClauseQ
- type BodyQ
- type GuardQ
- type StmtQ
- type RangeQ
- type SourceStrictnessQ
- type SourceUnpackednessQ
- type BangQ
- type BangTypeQ
- type VarBangTypeQ
- type StrictTypeQ
- type VarStrictTypeQ
- type FieldExpQ
- type PatQ
- type FieldPatQ
- type RuleBndrQ
- type TySynEqnQ
- type PatSynDirQ
- type PatSynArgsQ
- type FamilyResultSigQ
- type DerivStrategyQ
- type TyVarBndrUnit
- type TyVarBndrSpec
- type TyVarBndrVis
- value intPrimL
- value wordPrimL
- value floatPrimL
- value doublePrimL
- value integerL
- value rationalL
- value charL
- value stringL
- value stringPrimL
- value charPrimL
- value bytesPrimL
- value mkBytes
- value litP
- value varP
- value tupP
- value unboxedTupP
- value unboxedSumP
- value conP
- value uInfixP
- value parensP
- value infixP
- value tildeP
- value bangP
- value asP
- value wildP
- value recP
- value listP
- value sigP
- value viewP
- value typeP
- value invisP
- value fieldPat
- value normalB
- value guardedB
- value normalG
- value normalGE
- value patG
- value patGE
- value match
- value clause
- value dyn
- value varE
- value unboundVarE
- value labelE
- value implicitParamVarE
- value conE
- value litE
- value staticE
- value appE
- value appTypeE
- value uInfixE
- value parensE
- value infixE
- value infixApp
- value sectionL
- value sectionR
- value lamE
- value lam1E
- value lamCaseE
- value lamCasesE
- value tupE
- value unboxedTupE
- value unboxedSumE
- value condE
- value multiIfE
- value letE
- value caseE
- value appsE
- value listE
- value sigE
- value recConE
- value recUpdE
- value stringE
- value fieldExp
- value getFieldE
- value projectionE
- value typedSpliceE
- value typedBracketE
- value typeE
- value forallE
- value forallVisE
- value constrainedE
- value fromE
- value fromThenE
- value fromToE
- value fromThenToE
- value arithSeqE
- value fromR
- value fromThenR
- value fromToR
- value fromThenToR
- value doE
- value mdoE
- value compE
- value bindS
- value letS
- value noBindS
- value parS
- value recS
- value forallT
- value forallVisT
- value varT
- value conT
- value appT
- value appKindT
- value arrowT
- value mulArrowT
- value infixT
- value uInfixT
- value promotedInfixT
- value promotedUInfixT
- value parensT
- value equalityT
- value listT
- value tupleT
- value unboxedTupleT
- value unboxedSumT
- value sigT
- value litT
- value wildCardT
- value promotedT
- value promotedTupleT
- value promotedNilT
- value promotedConsT
- value implicitParamT
- value numTyLit
- value strTyLit
- value charTyLit
- value noSourceUnpackedness
- value sourceNoUnpack
- value sourceUnpack
- value noSourceStrictness
- value sourceLazy
- value sourceStrict
- value isStrict
- value notStrict
- value unpacked
- value bang
- value bangType
- value varBangType
- value strictType
- value varStrictType
- value cxt
- value classP
- value equalP
- value normalC
- value recC
- value infixC
- value forallC
- value gadtC
- value recGadtC
- value varK
- value conK
- value tupleK
- value arrowK
- value listK
- value appK
- value starK
- value constraintK
- class DefaultBndrFlag
- value plainTV
- value kindedTV
- value plainInvisTV
- value kindedInvisTV
- value plainBndrTV
- value kindedBndrTV
- value specifiedSpec
- value inferredSpec
- value bndrReq
- value bndrInvis
- value nominalR
- value representationalR
- value phantomR
- value inferR
- value valD
- value funD
- value tySynD
- value dataD
- value newtypeD
- value typeDataD
- value derivClause
- data DerivClause
- value stockStrategy
- value anyclassStrategy
- value newtypeStrategy
- value viaStrategy
- data DerivStrategy
- value classD
- value instanceD
- value instanceWithOverlapD
- data Overlap
- value sigD
- value kiSigD
- value standaloneDerivD
- value standaloneDerivWithStrategyD
- value defaultSigD
- value roleAnnotD
- value dataFamilyD
- value openTypeFamilyD
- value closedTypeFamilyD
- value dataInstD
- value newtypeInstD
- value tySynInstD
- value tySynEqn
- value injectivityAnn
- value noSig
- value kindSig
- value tyVarSig
- value infixLD
- value infixRD
- value infixND
- value defaultD
- value cCall
- value stdCall
- value cApi
- value prim
- value javaScript
- value unsafe
- value safe
- value interruptible
- value forImpD
- value funDep
- value ruleVar
- value typedRuleVar
- value valueAnnotation
- value typeAnnotation
- value moduleAnnotation
- value pragInlD
- value pragSpecD
- value pragSpecInlD
- value pragSpecED
- value pragSpecInlED
- value pragSpecInstD
- value pragRuleD
- value pragAnnD
- value pragLineD
- value pragCompleteD
- value patSynD
- value patSynSigD
- value unidir
- value implBidir
- value explBidir
- value prefixPatSyn
- value infixPatSyn
- value recordPatSyn
- value implicitParamBindD
- value thisModule
- value withDecDoc
- value withDecsDoc
- value funD_doc
- value dataD_doc
- value newtypeD_doc
- value typeDataD_doc
- value dataInstD_doc
- value newtypeInstD_doc
- value patSynD_doc
- Packagetemplate-haskell-2.25.0.0
- Exports294
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceLib.hs
Library functions
Abbreviations
Representation-polymorphic since template-haskell-2.17.0.0.
Constructors lifted to Q
Literals
mkBytes :: ForeignPtr Word8Pointer to the data
-> WordOffset from the pointer
-> WordNumber of bytes
-> Bytes
Create a Bytes datatype representing raw bytes to be embedded into the program/library binary.
Patterns
Pattern Guards
Use with caseE
Use with funD
Expressions
Dynamically binding a variable (unhygienic)
staticE x = [| static x |]Single-arg lambda
Lambda-case (case)
Lambda-cases (cases)
Ranges
Ranges with more indirection
Statements
Types
Type literals
Strictness
Deprecated. Use bang. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example usage: 'bang noSourceUnpackedness sourceStrict'
Deprecated. Use bang. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example usage: 'bang noSourceUnpackedness noSourceStrictness'
Deprecated. Use bang. See https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example usage: 'bang sourceUnpack sourceStrict'
Deprecated. As of template-haskell-2.11.0.0, StrictType has been replaced by BangType. Please use bangType instead.
Deprecated. As of template-haskell-2.11.0.0, VarStrictType has been replaced by VarBangType. Please use varBangType instead.
Class Contexts
Deprecated. As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please see equalityT.
Constructors
Kinds
Type variable binders
Methods
defaultBndrFlag :: flag
Instances3DefaultBndrFlag
DefaultBndrFlag BndrVisDefined in template-haskell-2.25.0.0 · Language.Haskell.TH.LibDefaultBndrFlag SpecificityDefined in template-haskell-2.25.0.0 · Language.Haskell.TH.LibDefaultBndrFlag ()Defined in template-haskell-2.25.0.0 · Language.Haskell.TH.Lib
Roles
Top Level Declarations
Data
A single deriving clause at the end of a datatype declaration.
Constructors
DerivClause (Maybe DerivStrategy) Cxt{ deriving stock (Eq, Ord) }
Instances7Eq, Data, Ord, Show, Generic, Lift, …
Eq DerivClauseDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxData DerivClauseDefined in ghc-internal-10.0.0 · GHC.Internal.Data.DataOrd DerivClauseDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxShow DerivClauseDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxGeneric DerivClauseDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxLift DerivClauseDefined in ghc-internal-10.0.0 · GHC.Internal.TH.Lifttype Rep DerivClause = D1 ('MetaDataDefined in ghc-internal-10.0.0 · GHC.Internal.TH.Syntax"DerivClause"
"GHC.Internal.TH.Syntax"
"ghc-internal"
'False) (C1 ('MetaCons"DerivClause"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe DerivStrategy)) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cxt)))
What the user explicitly requests when deriving an instance with
-XDerivingStrategies.
Constructors
StockStrategyderiving {stock} CAnyclassStrategyderiving {anyclass} C,-XDeriveAnyClassNewtypeStrategyderiving {newtype} C,-XGeneralizedNewtypeDerivingViaStrategy Typederiving C {via T},-XDerivingVia
Instances7Eq, Data, Ord, Show, Generic, Lift, …
Eq DerivStrategyDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxData DerivStrategyDefined in ghc-internal-10.0.0 · GHC.Internal.Data.DataOrd DerivStrategyDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxShow DerivStrategyDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxGeneric DerivStrategyDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxLift DerivStrategyDefined in ghc-internal-10.0.0 · GHC.Internal.TH.Lifttype Rep DerivStrategy = D1 ('MetaDataDefined in ghc-internal-10.0.0 · GHC.Internal.TH.Syntax"DerivStrategy"
"GHC.Internal.TH.Syntax"
"ghc-internal"
'False) ((C1 ('MetaCons"StockStrategy"
'PrefixI 'False) U1 :+: C1 ('MetaCons"AnyclassStrategy"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"NewtypeStrategy"
'PrefixI 'False) U1 :+: C1 ('MetaCons"ViaStrategy"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type))))
Class
Varieties of allowed instance overlap.
Constructors
OverlappableMay be overlapped by more specific instances
OverlappingMay overlap a more general instance
OverlapsBoth Overlapping and Overlappable
IncoherentBoth Overlapping and Overlappable, and pick an arbitrary one if multiple choices are available.
Instances7Eq, Data, Ord, Show, Generic, Lift, …
Eq OverlapDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxData OverlapDefined in ghc-internal-10.0.0 · GHC.Internal.Data.DataOrd OverlapDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxShow OverlapDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxGeneric OverlapDefined in ghc-internal-10.0.0 · GHC.Internal.TH.SyntaxLift OverlapDefined in ghc-internal-10.0.0 · GHC.Internal.TH.Lifttype Rep Overlap = D1 ('MetaDataDefined in ghc-internal-10.0.0 · GHC.Internal.TH.Syntax"Overlap"
"GHC.Internal.TH.Syntax"
"ghc-internal"
'False) ((C1 ('MetaCons"Overlappable"
'PrefixI 'False) U1 :+: C1 ('MetaCons"Overlapping"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"Overlaps"
'PrefixI 'False) U1 :+: C1 ('MetaCons"Incoherent"
'PrefixI 'False) U1))
Role annotations
Type Family / Data Family
Fixity
Default declaration
Foreign Function Interface (FFI)
Functional dependencies
Pragmas
Pattern Synonyms
Pattern synonym declaration
Pattern synonym type signature
Implicit Parameters
Implicit parameter binding declaration. Can only be used in let and where clauses which consist entirely of implicit bindings.
Reify
pure the Module at the place of splicing. Can be used as an input for reifyModule.
Documentation
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.
Variant of withDecDoc that applies the same documentation to multiple declarations. Useful for documenting quoted declarations.
funD_doc Variant of funD that attaches Haddock documentation.
dataD_doc Variant of dataD that attaches Haddock documentation.
newtypeD_doc Variant of newtypeD that attaches Haddock documentation.
typeDataD_doc Variant of typeDataD that attaches Haddock documentation.
dataInstD_doc Variant of dataInstD that attaches Haddock documentation.
newtypeInstD_doc Variant of newtypeInstD that attaches Haddock documentation.
patSynD_doc Variant of patSynD that attaches Haddock documentation.