Language.Haskell.TH.Lib

template-haskell-2.17.0.0: Support library for Template Haskell

Safe Haskell | Safe
Language | Haskell2010

Language.Haskell.TH.Lib

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
      - Foreign Function Interface (FFI)
      - Functional dependencies
      - Pragmas
      - Pattern Synonyms
      - Implicit Parameters
  - Reify

Description

Language.Haskell.TH.Lib contains lots of useful helper functions for generating and manipulating Template Haskell terms

Synopsis

- type InfoQ = Q Info
- type ExpQ = Q Exp
- type TExpQ (a :: TYPE r) = Q (TExp a)
- type CodeQ = Code Q :: TYPE r -> Type
- type DecQ = Q Dec
- type DecsQ = Q [Dec]
- type ConQ = Q Con
- type TypeQ = Q Type
- type KindQ = Q Kind
- type TyLitQ = Q TyLit
- type CxtQ = Q Cxt
- type PredQ = Q Pred
- type DerivClauseQ = Q DerivClause
- 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 SourceStrictnessQ = Q SourceStrictness
- type SourceUnpackednessQ = Q SourceUnpackedness
- type BangQ = Q Bang
- type BangTypeQ = Q BangType
- type VarBangTypeQ = Q VarBangType
- type StrictTypeQ = Q StrictType
- type VarStrictTypeQ = Q VarStrictType
- type FieldExpQ = Q FieldExp
- type PatQ = Q Pat
- type FieldPatQ = Q FieldPat
- type RuleBndrQ = Q RuleBndr
- type TySynEqnQ = Q TySynEqn
- type PatSynDirQ = Q PatSynDir
- type PatSynArgsQ = Q PatSynArgs
- type FamilyResultSigQ = Q FamilyResultSig
- type DerivStrategyQ = Q DerivStrategy
- type TyVarBndrUnit = TyVarBndr ()
- type TyVarBndrSpec = TyVarBndr Specificity
- intPrimL :: Integer -> Lit
- wordPrimL :: Integer -> Lit
- floatPrimL :: Rational -> Lit
- doublePrimL :: Rational -> Lit
- integerL :: Integer -> Lit
- rationalL :: Rational -> Lit
- charL :: Char -> Lit
- stringL :: String -> Lit
- stringPrimL :: [Word8] -> Lit
- charPrimL :: Char -> Lit
- bytesPrimL :: Bytes -> Lit
- mkBytes :: ForeignPtr Word8 -> Word -> Word -> Bytes
- litP :: Quote m => Lit -> m Pat
- varP :: Quote m => Name -> m Pat
- tupP :: Quote m => [m Pat] -> m Pat
- unboxedTupP :: Quote m => [m Pat] -> m Pat
- unboxedSumP :: Quote m => m Pat -> SumAlt -> SumArity -> m Pat
- conP :: Quote m => Name -> [m Pat] -> m Pat
- uInfixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
- parensP :: Quote m => m Pat -> m Pat
- infixP :: Quote m => m Pat -> Name -> m Pat -> m Pat
- tildeP :: Quote m => m Pat -> m Pat
- bangP :: Quote m => m Pat -> m Pat
- asP :: Quote m => Name -> m Pat -> m Pat
- wildP :: Quote m => m Pat
- recP :: Quote m => Name -> [m FieldPat] -> m Pat
- listP :: Quote m => [m Pat] -> m Pat
- sigP :: Quote m => m Pat -> m Type -> m Pat
- viewP :: Quote m => m Exp -> m Pat -> m Pat
- fieldPat :: Quote m => Name -> m Pat -> m FieldPat
- normalB :: Quote m => m Exp -> m Body
- guardedB :: Quote m => [m (Guard, Exp)] -> m Body
- normalG :: Quote m => m Exp -> m Guard
- normalGE :: Quote m => m Exp -> m Exp -> m (Guard, Exp)
- patG :: Quote m => [m Stmt] -> m Guard
- patGE :: Quote m => [m Stmt] -> m Exp -> m (Guard, Exp)
- match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match
- clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause
- dyn :: Quote m => String -> m Exp
- varE :: Quote m => Name -> m Exp
- unboundVarE :: Quote m => Name -> m Exp
- labelE :: Quote m => String -> m Exp
- implicitParamVarE :: Quote m => String -> m Exp
- conE :: Quote m => Name -> m Exp
- litE :: Quote m => Lit -> m Exp
- staticE :: Quote m => m Exp -> m Exp
- appE :: Quote m => m Exp -> m Exp -> m Exp
- appTypeE :: Quote m => m Exp -> m Type -> m Exp
- uInfixE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
- parensE :: Quote m => m Exp -> m Exp
- infixE :: Quote m => Maybe (m Exp) -> m Exp -> Maybe (m Exp) -> m Exp
- infixApp :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
- sectionL :: Quote m => m Exp -> m Exp -> m Exp
- sectionR :: Quote m => m Exp -> m Exp -> m Exp
- lamE :: Quote m => [m Pat] -> m Exp -> m Exp
- lam1E :: Quote m => m Pat -> m Exp -> m Exp
- lamCaseE :: Quote m => [m Match] -> m Exp
- tupE :: Quote m => [m Exp] -> m Exp
- unboxedTupE :: Quote m => [m Exp] -> m Exp
- unboxedSumE :: Quote m => m Exp -> SumAlt -> SumArity -> m Exp
- condE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
- multiIfE :: Quote m => [m (Guard, Exp)] -> m Exp
- letE :: Quote m => [m Dec] -> m Exp -> m Exp
- caseE :: Quote m => m Exp -> [m Match] -> m Exp
- appsE :: Quote m => [m Exp] -> m Exp
- listE :: Quote m => [m Exp] -> m Exp
- sigE :: Quote m => m Exp -> m Type -> m Exp
- recConE :: Quote m => Name -> [m (Name, Exp)] -> m Exp
- recUpdE :: Quote m => m Exp -> [m (Name, Exp)] -> m Exp
- stringE :: Quote m => String -> m Exp
- fieldExp :: Quote m => Name -> m Exp -> m (Name, Exp)
- fromE :: Quote m => m Exp -> m Exp
- fromThenE :: Quote m => m Exp -> m Exp -> m Exp
- fromToE :: Quote m => m Exp -> m Exp -> m Exp
- fromThenToE :: Quote m => m Exp -> m Exp -> m Exp -> m Exp
- arithSeqE :: Quote m => m Range -> m Exp
- fromR :: Quote m => m Exp -> m Range
- fromThenR :: Quote m => m Exp -> m Exp -> m Range
- fromToR :: Quote m => m Exp -> m Exp -> m Range
- fromThenToR :: Quote m => m Exp -> m Exp -> m Exp -> m Range
- doE :: Quote m => [m Stmt] -> m Exp
- mdoE :: Quote m => [m Stmt] -> m Exp
- compE :: Quote m => [m Stmt] -> m Exp
- bindS :: Quote m => m Pat -> m Exp -> m Stmt
- letS :: Quote m => [m Dec] -> m Stmt
- noBindS :: Quote m => m Exp -> m Stmt
- parS :: Quote m => [[m Stmt]] -> m Stmt
- recS :: Quote m => [m Stmt] -> m Stmt
- forallT :: Quote m => [TyVarBndr Specificity] -> m Cxt -> m Type -> m Type
- forallVisT :: Quote m => [m (TyVarBndr ())] -> m Type -> m Type
- varT :: Quote m => Name -> m Type
- conT :: Quote m => Name -> m Type
- appT :: Quote m => m Type -> m Type -> m Type
- appKindT :: Quote m => m Type -> m Kind -> m Type
- arrowT :: Quote m => m Type
- infixT :: Quote m => m Type -> Name -> m Type -> m Type
- mulArrowT :: Quote m => m Type
- uInfixT :: Quote m => m Type -> Name -> m Type -> m Type
- parensT :: Quote m => m Type -> m Type
- equalityT :: Quote m => m Type
- listT :: Quote m => m Type
- tupleT :: Quote m => Int -> m Type
- unboxedTupleT :: Quote m => Int -> m Type
- unboxedSumT :: Quote m => SumArity -> m Type
- sigT :: Quote m => m Type -> Kind -> m Type
- litT :: Quote m => m TyLit -> m Type
- wildCardT :: Quote m => m Type
- promotedT :: Quote m => Name -> m Type
- promotedTupleT :: Quote m => Int -> m Type
- promotedNilT :: Quote m => m Type
- promotedConsT :: Quote m => m Type
- implicitParamT :: Quote m => String -> m Type -> m Type
- numTyLit :: Quote m => Integer -> m TyLit
- strTyLit :: Quote m => String -> m TyLit
- noSourceUnpackedness :: Quote m => m SourceUnpackedness
- sourceNoUnpack :: Quote m => m SourceUnpackedness
- sourceUnpack :: Quote m => m SourceUnpackedness
- noSourceStrictness :: Quote m => m SourceStrictness
- sourceLazy :: Quote m => m SourceStrictness
- sourceStrict :: Quote m => m SourceStrictness
- isStrict :: Quote m => m Strict
- notStrict :: Quote m => m Strict
- unpacked :: Quote m => m Strict
- bang :: Quote m => m SourceUnpackedness -> m SourceStrictness -> m Bang
- bangType :: Quote m => m Bang -> m Type -> m BangType
- varBangType :: Quote m => Name -> m BangType -> m VarBangType
- strictType :: Quote m => m Strict -> m Type -> m StrictType
- varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType
- cxt :: Quote m => [m Pred] -> m Cxt
- classP :: Quote m => Name -> [m Type] -> m Pred
- equalP :: Quote m => m Type -> m Type -> m Pred
- normalC :: Quote m => Name -> [m BangType] -> m Con
- recC :: Quote m => Name -> [m VarBangType] -> m Con
- infixC :: Quote m => m (Bang, Type) -> Name -> m (Bang, Type) -> m Con
- forallC :: Quote m => [TyVarBndr Specificity] -> m Cxt -> m Con -> m Con
- gadtC :: Quote m => [Name] -> [m StrictType] -> m Type -> m Con
- recGadtC :: Quote m => [Name] -> [m VarStrictType] -> m Type -> m Con
- varK :: Name -> Kind
- conK :: Name -> Kind
- tupleK :: Int -> Kind
- arrowK :: Kind
- listK :: Kind
- appK :: Kind -> Kind -> Kind
- starK :: Kind
- constraintK :: Kind
- plainTV :: Name -> TyVarBndr ()
- kindedTV :: Name -> Kind -> TyVarBndr ()
- plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity)
- kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity)
- specifiedSpec :: Specificity
- inferredSpec :: Specificity
- nominalR :: Role
- representationalR :: Role
- phantomR :: Role
- inferR :: Role
- valD :: Quote m => m Pat -> m Body -> [m Dec] -> m Dec
- funD :: Quote m => Name -> [m Clause] -> m Dec
- tySynD :: Quote m => Name -> [TyVarBndr ()] -> m Type -> m Dec
- dataD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> [m Con] -> [m DerivClause] -> m Dec
- newtypeD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> Maybe Kind -> m Con -> [m DerivClause] -> m Dec
- derivClause :: Quote m => Maybe DerivStrategy -> [m Pred] -> m DerivClause
- data DerivClause = DerivClause (Maybe DerivStrategy) Cxt
- stockStrategy :: Quote m => m DerivStrategy
- anyclassStrategy :: Quote m => m DerivStrategy
- newtypeStrategy :: Quote m => m DerivStrategy
- viaStrategy :: Quote m => m Type -> m DerivStrategy
- data DerivStrategy
  - = StockStrategy
  - | AnyclassStrategy
  - | NewtypeStrategy
  - | ViaStrategy Type
- classD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> [FunDep] -> [m Dec] -> m Dec
- instanceD :: Quote m => m Cxt -> m Type -> [m Dec] -> m Dec
- instanceWithOverlapD :: Quote m => Maybe Overlap -> m Cxt -> m Type -> [m Dec] -> m Dec
- data Overlap
  - = Overlappable
  - | Overlapping
  - | Overlaps
  - | Incoherent
- sigD :: Quote m => Name -> m Type -> m Dec
- kiSigD :: Quote m => Name -> m Kind -> m Dec
- standaloneDerivD :: Quote m => m Cxt -> m Type -> m Dec
- standaloneDerivWithStrategyD :: Quote m => Maybe DerivStrategy -> m Cxt -> m Type -> m Dec
- defaultSigD :: Quote m => Name -> m Type -> m Dec
- roleAnnotD :: Quote m => Name -> [Role] -> m Dec
- dataFamilyD :: Quote m => Name -> [TyVarBndr ()] -> Maybe Kind -> m Dec
- openTypeFamilyD :: Quote m => Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> m Dec
- closedTypeFamilyD :: Quote m => Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> [m TySynEqn] -> m Dec
- dataInstD :: Quote m => m Cxt -> Name -> [m Type] -> Maybe Kind -> [m Con] -> [m DerivClause] -> m Dec
- newtypeInstD :: Quote m => m Cxt -> Name -> [m Type] -> Maybe Kind -> m Con -> [m DerivClause] -> m Dec
- tySynInstD :: Quote m => m TySynEqn -> m Dec
- tySynEqn :: Quote m => Maybe [TyVarBndr ()] -> m Type -> m Type -> m TySynEqn
- injectivityAnn :: Name -> [Name] -> InjectivityAnn
- noSig :: FamilyResultSig
- kindSig :: Kind -> FamilyResultSig
- tyVarSig :: TyVarBndr () -> FamilyResultSig
- infixLD :: Quote m => Int -> Name -> m Dec
- infixRD :: Quote m => Int -> Name -> m Dec
- infixND :: Quote m => Int -> Name -> m Dec
- cCall :: Callconv
- stdCall :: Callconv
- cApi :: Callconv
- prim :: Callconv
- javaScript :: Callconv
- unsafe :: Safety
- safe :: Safety
- interruptible :: Safety
- forImpD :: Quote m => Callconv -> Safety -> String -> Name -> m Type -> m Dec
- funDep :: [Name] -> [Name] -> FunDep
- ruleVar :: Quote m => Name -> m RuleBndr
- typedRuleVar :: Quote m => Name -> m Type -> m RuleBndr
- valueAnnotation :: Name -> AnnTarget
- typeAnnotation :: Name -> AnnTarget
- moduleAnnotation :: AnnTarget
- pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec
- pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec
- pragSpecInlD :: Quote m => Name -> m Type -> Inline -> Phases -> m Dec
- pragSpecInstD :: Quote m => m Type -> m Dec
- pragRuleD :: Quote m => String -> [m RuleBndr] -> m Exp -> m Exp -> Phases -> m Dec
- pragAnnD :: Quote m => AnnTarget -> m Exp -> m Dec
- pragLineD :: Quote m => Int -> String -> m Dec
- pragCompleteD :: Quote m => [Name] -> Maybe Name -> m Dec
- patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec
- patSynSigD :: Quote m => Name -> m Type -> m Dec
- unidir :: Quote m => m PatSynDir
- implBidir :: Quote m => m PatSynDir
- explBidir :: Quote m => [m Clause] -> m PatSynDir
- prefixPatSyn :: Quote m => [Name] -> m PatSynArgs
- infixPatSyn :: Quote m => Name -> Name -> m PatSynArgs
- recordPatSyn :: Quote m => [Name] -> m PatSynArgs
- implicitParamBindD :: Quote m => String -> m Exp -> m Dec
- thisModule :: Q Module

# Library functions

## Abbreviations

type InfoQ = Q Info Source #

type ExpQ = Q Exp Source #

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

Levity-polymorphic since template-haskell-2.17.0.0. type TExpQ :: TYPE r -> Kind.Type

type CodeQ = Code Q :: TYPE r -> Type Source #

type DecQ = Q Dec Source #

type DecsQ = Q [Dec] Source #

type ConQ = Q Con Source #

type TypeQ = Q Type Source #

type KindQ = Q Kind Source #

type TyLitQ = Q TyLit Source #

type CxtQ = Q Cxt Source #

type PredQ = Q Pred Source #

type DerivClauseQ = Q DerivClause Source #

type MatchQ = Q Match Source #

type ClauseQ = Q Clause Source #

type BodyQ = Q Body Source #

type GuardQ = Q Guard Source #

type StmtQ = Q Stmt Source #

type RangeQ = Q Range Source #

type SourceStrictnessQ = Q SourceStrictness Source #

type SourceUnpackednessQ = Q SourceUnpackedness Source #

type BangQ = Q Bang Source #

type BangTypeQ = Q BangType Source #

type VarBangTypeQ = Q VarBangType Source #

type StrictTypeQ = Q StrictType Source #

type VarStrictTypeQ = Q VarStrictType Source #

type FieldExpQ = Q FieldExp Source #

type PatQ = Q Pat Source #

type FieldPatQ = Q FieldPat Source #

type RuleBndrQ = Q RuleBndr Source #

type TySynEqnQ = Q TySynEqn Source #

type PatSynDirQ = Q PatSynDir Source #

type PatSynArgsQ = Q PatSynArgs Source #

type FamilyResultSigQ = Q FamilyResultSig Source #

type DerivStrategyQ = Q DerivStrategy Source #

type TyVarBndrUnit = TyVarBndr () Source #

type TyVarBndrSpec = TyVarBndr Specificity Source #

## Constructors lifted to `Q`

### Literals

intPrimL :: Integer -> Lit Source #

wordPrimL :: Integer -> Lit Source #

floatPrimL :: Rational -> Lit Source #

doublePrimL :: Rational -> Lit Source #

integerL :: Integer -> Lit Source #

rationalL :: Rational -> Lit Source #

charL :: Char -> Lit Source #

stringL :: String -> Lit Source #

stringPrimL :: [Word8] -> Lit Source #

charPrimL :: Char -> Lit Source #

bytesPrimL :: Bytes -> Lit Source #

mkBytes Source #

Arguments

:: ForeignPtr Word8 | Pointer to the data
-> Word | Offset from the pointer
-> Word | Number of bytes
-> Bytes |

Create a Bytes datatype representing raw bytes to be embedded into the program/library binary.

Since: template-haskell-2.16.0.0

### Patterns

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 #

unboxedSumP :: Quote m => m Pat -> SumAlt -> SumArity -> m Pat Source #

conP :: Quote m => 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 #

infixP :: Quote m => m Pat -> Name -> 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 #

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

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

### Pattern Guards

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

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

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 :: 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`

### Expressions

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

Dynamically binding a variable (unhygenic)

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

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

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

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

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

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

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

    staticE x = [| static x |]

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

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

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

parensE :: Quote m => 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 #

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

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

unboxedSumE :: Quote m => m Exp -> SumAlt -> SumArity -> 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 #

appsE :: Quote m => [m Exp] -> 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 #

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

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

#### Ranges

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 #

#### Ranges with more indirection

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

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 #

#### Statements

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

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

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

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 #

### Types

forallT :: Quote 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 #

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

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

arrowT :: Quote m => m Type Source #

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

mulArrowT :: Quote m => m Type Source #

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

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

equalityT :: Quote m => m Type Source #

listT :: Quote m => m Type Source #

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

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

unboxedSumT :: Quote m => SumArity -> m Type Source #

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

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

wildCardT :: Quote m => m Type Source #

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

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

promotedNilT :: Quote m => m Type Source #

promotedConsT :: Quote m => m Type Source #

implicitParamT :: Quote m => String -> m Type -> m Type Source #

#### Type literals

numTyLit :: Quote m => Integer -> m TyLit Source #

strTyLit :: Quote m => String -> m TyLit Source #

#### Strictness

noSourceUnpackedness :: Quote m => m SourceUnpackedness Source #

sourceNoUnpack :: Quote m => m SourceUnpackedness Source #

sourceUnpack :: Quote m => m SourceUnpackedness Source #

noSourceStrictness :: Quote m => m SourceStrictness Source #

sourceLazy :: Quote m => m SourceStrictness Source #

sourceStrict :: Quote m => m SourceStrictness Source #

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'

bang :: Quote m => m SourceUnpackedness -> m SourceStrictness -> m Bang Source #

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

varBangType :: Quote m => Name -> m BangType -> m VarBangType 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.

#### Class Contexts

cxt :: Quote m => [m Pred] -> m Cxt 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`.

#### Constructors

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 => [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 #

### Kinds

varK :: Name -> Kind Source #

conK :: Name -> Kind Source #

tupleK :: Int -> Kind Source #

arrowK :: Kind Source #

listK :: Kind Source #

appK :: Kind -> Kind -> Kind Source #

starK :: Kind Source #

constraintK :: Kind Source #

### Type variable binders

plainTV :: Name -> TyVarBndr () Source #

kindedTV :: Name -> Kind -> TyVarBndr () Source #

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

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

specifiedSpec :: Specificity Source #

inferredSpec :: Specificity Source #

### Roles

nominalR :: Role Source #

representationalR :: Role Source #

phantomR :: Role Source #

inferR :: Role Source #

### Top Level Declarations

#### Data

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 -> [TyVarBndr ()] -> m Type -> m Dec Source #

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

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

derivClause :: Quote m => Maybe DerivStrategy -> [m Pred] -> m DerivClause Source #

data DerivClause Source #

A single `deriving` clause at the end of a datatype.

Constructors

DerivClause (Maybe DerivStrategy) Cxt |
    { deriving stock (Eq, Ord) }

#### Instances

Instances details

Eq DerivClause # |
Instance details Defined in Language.Haskell.TH.Syntax Methods (==) :: DerivClause -> DerivClause -> Bool Source # (/=) :: DerivClause -> DerivClause -> Bool Source #
Data DerivClause # |
Instance details Defined in Language.Haskell.TH.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DerivClause -> c DerivClause Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DerivClause Source # toConstr :: DerivClause -> Constr Source # dataTypeOf :: DerivClause -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DerivClause) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DerivClause) Source # gmapT :: (forall b. Data b => b -> b) -> DerivClause -> DerivClause Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DerivClause -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DerivClause -> r Source # gmapQ :: (forall d. Data d => d -> u) -> DerivClause -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> DerivClause -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DerivClause -> m DerivClause Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivClause -> m DerivClause Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivClause -> m DerivClause Source #
Ord DerivClause # |
Instance details Defined in Language.Haskell.TH.Syntax Methods compare :: DerivClause -> DerivClause -> Ordering Source # (<) :: DerivClause -> DerivClause -> Bool Source # (<=) :: DerivClause -> DerivClause -> Bool Source # (>) :: DerivClause -> DerivClause -> Bool Source # (>=) :: DerivClause -> DerivClause -> Bool Source # max :: DerivClause -> DerivClause -> DerivClause Source # min :: DerivClause -> DerivClause -> DerivClause Source #
Show DerivClause # |
Instance details Defined in Language.Haskell.TH.Syntax Methods showsPrec :: Int -> DerivClause -> ShowS Source # show :: DerivClause -> String Source # showList :: [DerivClause] -> ShowS Source #
Generic DerivClause # |
Instance details Defined in Language.Haskell.TH.Syntax Associated Types type Rep DerivClause :: Type -> Type Source # Methods from :: DerivClause -> Rep DerivClause x Source # to :: Rep DerivClause x -> DerivClause Source #
type Rep DerivClause # |
Instance details Defined in Language.Haskell.TH.Syntax type Rep DerivClause = D1 ('MetaData "DerivClause" "Language.Haskell.TH.Syntax" "template-haskell" 'False) (C1 ('MetaCons "DerivClause" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe DerivStrategy)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Cxt)))

stockStrategy :: Quote m => m DerivStrategy Source #

anyclassStrategy :: Quote m => m DerivStrategy Source #

newtypeStrategy :: Quote m => m DerivStrategy Source #

viaStrategy :: Quote m => m Type -> m DerivStrategy Source #

data DerivStrategy Source #

What the user explicitly requests when deriving an instance.

Constructors

StockStrategy | A "standard" derived instance
AnyclassStrategy |
    -XDeriveAnyClass
NewtypeStrategy |
    -XGeneralizedNewtypeDeriving
ViaStrategy Type |
    -XDerivingVia

#### Instances

Instances details

Eq DerivStrategy # |
Instance details Defined in Language.Haskell.TH.Syntax Methods (==) :: DerivStrategy -> DerivStrategy -> Bool Source # (/=) :: DerivStrategy -> DerivStrategy -> Bool Source #
Data DerivStrategy # |
Instance details Defined in Language.Haskell.TH.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DerivStrategy -> c DerivStrategy Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DerivStrategy Source # toConstr :: DerivStrategy -> Constr Source # dataTypeOf :: DerivStrategy -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DerivStrategy) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DerivStrategy) Source # gmapT :: (forall b. Data b => b -> b) -> DerivStrategy -> DerivStrategy Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DerivStrategy -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DerivStrategy -> r Source # gmapQ :: (forall d. Data d => d -> u) -> DerivStrategy -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> DerivStrategy -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DerivStrategy -> m DerivStrategy Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivStrategy -> m DerivStrategy Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivStrategy -> m DerivStrategy Source #
Ord DerivStrategy # |
Instance details Defined in Language.Haskell.TH.Syntax Methods compare :: DerivStrategy -> DerivStrategy -> Ordering Source # (<) :: DerivStrategy -> DerivStrategy -> Bool Source # (<=) :: DerivStrategy -> DerivStrategy -> Bool Source # (>) :: DerivStrategy -> DerivStrategy -> Bool Source # (>=) :: DerivStrategy -> DerivStrategy -> Bool Source # max :: DerivStrategy -> DerivStrategy -> DerivStrategy Source # min :: DerivStrategy -> DerivStrategy -> DerivStrategy Source #
Show DerivStrategy # |
Instance details Defined in Language.Haskell.TH.Syntax Methods showsPrec :: Int -> DerivStrategy -> ShowS Source # show :: DerivStrategy -> String Source # showList :: [DerivStrategy] -> ShowS Source #
Generic DerivStrategy # |
Instance details Defined in Language.Haskell.TH.Syntax Associated Types type Rep DerivStrategy :: Type -> Type Source # Methods from :: DerivStrategy -> Rep DerivStrategy x Source # to :: Rep DerivStrategy x -> DerivStrategy Source #
type Rep DerivStrategy # |
Instance details Defined in Language.Haskell.TH.Syntax type Rep DerivStrategy = D1 ('MetaData "DerivStrategy" "Language.Haskell.TH.Syntax" "template-haskell" 'False) ((C1 ('MetaCons "StockStrategy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AnyclassStrategy" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NewtypeStrategy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ViaStrategy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Type))))

#### Class

classD :: Quote m => m Cxt -> Name -> [TyVarBndr ()] -> [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 #

data Overlap Source #

Varieties of allowed instance overlap.

Constructors

Overlappable | May be overlapped by more specific instances
Overlapping | May overlap a more general instance
Overlaps | Both `Overlapping` and `Overlappable`
Incoherent | Both `Overlappable` and `Overlappable`, and pick an arbitrary one if multiple choices are available.

#### Instances

Instances details

Eq Overlap # |
Instance details Defined in Language.Haskell.TH.Syntax Methods (==) :: Overlap -> Overlap -> Bool Source # (/=) :: Overlap -> Overlap -> Bool Source #
Data Overlap # |
Instance details Defined in Language.Haskell.TH.Syntax Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Overlap -> c Overlap Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Overlap Source # toConstr :: Overlap -> Constr Source # dataTypeOf :: Overlap -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Overlap) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Overlap) Source # gmapT :: (forall b. Data b => b -> b) -> Overlap -> Overlap Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Overlap -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Overlap -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Overlap -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Overlap -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Overlap -> m Overlap Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Overlap -> m Overlap Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Overlap -> m Overlap Source #
Ord Overlap # |
Instance details Defined in Language.Haskell.TH.Syntax Methods compare :: Overlap -> Overlap -> Ordering Source # (<) :: Overlap -> Overlap -> Bool Source # (<=) :: Overlap -> Overlap -> Bool Source # (>) :: Overlap -> Overlap -> Bool Source # (>=) :: Overlap -> Overlap -> Bool Source # max :: Overlap -> Overlap -> Overlap Source # min :: Overlap -> Overlap -> Overlap Source #
Show Overlap # |
Instance details Defined in Language.Haskell.TH.Syntax Methods showsPrec :: Int -> Overlap -> ShowS Source # show :: Overlap -> String Source # showList :: [Overlap] -> ShowS Source #
Generic Overlap # |
Instance details Defined in Language.Haskell.TH.Syntax Associated Types type Rep Overlap :: Type -> Type Source # Methods from :: Overlap -> Rep Overlap x Source # to :: Rep Overlap x -> Overlap Source #
type Rep Overlap # |
Instance details Defined in Language.Haskell.TH.Syntax type Rep Overlap = D1 ('MetaData "Overlap" "Language.Haskell.TH.Syntax" "template-haskell" 'False) ((C1 ('MetaCons "Overlappable" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Overlapping" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Overlaps" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Incoherent" 'PrefixI 'False) (U1 :: Type -> Type)))

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

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

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

standaloneDerivWithStrategyD :: Quote m => Maybe DerivStrategy -> m Cxt -> m Type -> m Dec Source #

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

#### Role annotations

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

#### Type Family / Data Family

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

openTypeFamilyD :: Quote m => Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> m Dec Source #

closedTypeFamilyD :: Quote m => Name -> [TyVarBndr ()] -> FamilyResultSig -> Maybe InjectivityAnn -> [m TySynEqn] -> m Dec Source #

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

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

tySynInstD :: Quote m => m TySynEqn -> m Dec Source #

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

injectivityAnn :: Name -> [Name] -> InjectivityAnn Source #

noSig :: FamilyResultSig Source #

kindSig :: Kind -> FamilyResultSig Source #

tyVarSig :: TyVarBndr () -> FamilyResultSig Source #

#### Fixity

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

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

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

#### Foreign Function Interface (FFI)

cCall :: Callconv Source #

stdCall :: Callconv Source #

cApi :: Callconv Source #

prim :: Callconv Source #

javaScript :: Callconv Source #

unsafe :: Safety Source #

safe :: Safety Source #

interruptible :: Safety Source #

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

#### Functional dependencies

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

#### Pragmas

ruleVar :: Quote m => Name -> m RuleBndr Source #

typedRuleVar :: Quote m => Name -> m Type -> m RuleBndr Source #

valueAnnotation :: Name -> AnnTarget Source #

typeAnnotation :: Name -> AnnTarget Source #

moduleAnnotation :: AnnTarget Source #

pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec Source #

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

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

pragSpecInstD :: Quote m => m Type -> m Dec Source #

pragRuleD :: Quote m => String -> [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 #

pragCompleteD :: Quote m => [Name] -> Maybe Name -> m Dec Source #

#### Pattern Synonyms

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

unidir :: Quote m => m PatSynDir Source #

implBidir :: Quote m => m PatSynDir Source #

explBidir :: Quote m => [m Clause] -> m PatSynDir Source #

prefixPatSyn :: Quote m => [Name] -> m PatSynArgs Source #

infixPatSyn :: Quote m => Name -> Name -> m PatSynArgs Source #

recordPatSyn :: Quote m => [Name] -> m PatSynArgs Source #

#### Implicit Parameters

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.

## Reify

thisModule :: Q Module Source #

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