template-haskell-2.12.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
  - Reify

Description

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 = 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 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
- 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
- litP :: Lit -> PatQ
- varP :: Name -> PatQ
- tupP :: [PatQ] -> PatQ
- unboxedTupP :: [PatQ] -> PatQ
- unboxedSumP :: PatQ -> SumAlt -> SumArity -> PatQ
- conP :: Name -> [PatQ] -> PatQ
- uInfixP :: PatQ -> Name -> PatQ -> PatQ
- parensP :: PatQ -> PatQ
- infixP :: PatQ -> Name -> PatQ -> PatQ
- tildeP :: PatQ -> PatQ
- bangP :: PatQ -> PatQ
- asP :: Name -> PatQ -> PatQ
- wildP :: PatQ
- recP :: Name -> [FieldPatQ] -> PatQ
- listP :: [PatQ] -> PatQ
- sigP :: PatQ -> TypeQ -> PatQ
- viewP :: ExpQ -> PatQ -> PatQ
- fieldPat :: Name -> PatQ -> FieldPatQ
- normalB :: ExpQ -> BodyQ
- guardedB :: [Q (Guard, Exp)] -> BodyQ
- normalG :: ExpQ -> GuardQ
- normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp)
- patG :: [StmtQ] -> GuardQ
- patGE :: [StmtQ] -> ExpQ -> Q (Guard, Exp)
- match :: PatQ -> BodyQ -> [DecQ] -> MatchQ
- clause :: [PatQ] -> BodyQ -> [DecQ] -> ClauseQ
- dyn :: String -> ExpQ
- varE :: Name -> ExpQ
- unboundVarE :: Name -> ExpQ
- conE :: Name -> ExpQ
- litE :: Lit -> ExpQ
- appE :: ExpQ -> ExpQ -> ExpQ
- appTypeE :: ExpQ -> TypeQ -> ExpQ
- uInfixE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
- parensE :: ExpQ -> ExpQ
- staticE :: ExpQ -> ExpQ
- infixE :: Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ
- infixApp :: ExpQ -> ExpQ -> ExpQ -> ExpQ
- sectionL :: ExpQ -> ExpQ -> ExpQ
- sectionR :: ExpQ -> ExpQ -> ExpQ
- lamE :: [PatQ] -> ExpQ -> ExpQ
- lam1E :: PatQ -> ExpQ -> ExpQ
- lamCaseE :: [MatchQ] -> ExpQ
- tupE :: [ExpQ] -> ExpQ
- unboxedTupE :: [ExpQ] -> ExpQ
- unboxedSumE :: ExpQ -> SumAlt -> SumArity -> ExpQ
- condE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
- multiIfE :: [Q (Guard, Exp)] -> ExpQ
- letE :: [DecQ] -> ExpQ -> ExpQ
- caseE :: ExpQ -> [MatchQ] -> ExpQ
- appsE :: [ExpQ] -> ExpQ
- listE :: [ExpQ] -> ExpQ
- sigE :: ExpQ -> TypeQ -> ExpQ
- recConE :: Name -> [Q (Name, Exp)] -> ExpQ
- recUpdE :: ExpQ -> [Q (Name, Exp)] -> ExpQ
- stringE :: String -> ExpQ
- fieldExp :: Name -> ExpQ -> Q (Name, Exp)
- fromE :: ExpQ -> ExpQ
- fromThenE :: ExpQ -> ExpQ -> ExpQ
- fromToE :: ExpQ -> ExpQ -> ExpQ
- fromThenToE :: ExpQ -> ExpQ -> ExpQ -> ExpQ
- arithSeqE :: RangeQ -> ExpQ
- fromR :: ExpQ -> RangeQ
- fromThenR :: ExpQ -> ExpQ -> RangeQ
- fromToR :: ExpQ -> ExpQ -> RangeQ
- fromThenToR :: ExpQ -> ExpQ -> ExpQ -> RangeQ
- doE :: [StmtQ] -> ExpQ
- compE :: [StmtQ] -> ExpQ
- bindS :: PatQ -> ExpQ -> StmtQ
- letS :: [DecQ] -> StmtQ
- noBindS :: ExpQ -> StmtQ
- parS :: [[StmtQ]] -> StmtQ
- forallT :: [TyVarBndr] -> CxtQ -> TypeQ -> TypeQ
- varT :: Name -> TypeQ
- conT :: Name -> TypeQ
- appT :: TypeQ -> TypeQ -> TypeQ
- arrowT :: TypeQ
- infixT :: TypeQ -> Name -> TypeQ -> TypeQ
- uInfixT :: TypeQ -> Name -> TypeQ -> TypeQ
- parensT :: TypeQ -> TypeQ
- equalityT :: TypeQ
- listT :: TypeQ
- tupleT :: Int -> TypeQ
- unboxedTupleT :: Int -> TypeQ
- unboxedSumT :: SumArity -> TypeQ
- sigT :: TypeQ -> Kind -> TypeQ
- litT :: TyLitQ -> TypeQ
- wildCardT :: TypeQ
- promotedT :: Name -> TypeQ
- promotedTupleT :: Int -> TypeQ
- promotedNilT :: TypeQ
- promotedConsT :: TypeQ
- numTyLit :: Integer -> TyLitQ
- strTyLit :: String -> TyLitQ
- noSourceUnpackedness :: SourceUnpackednessQ
- sourceNoUnpack :: SourceUnpackednessQ
- sourceUnpack :: SourceUnpackednessQ
- noSourceStrictness :: SourceStrictnessQ
- sourceLazy :: SourceStrictnessQ
- sourceStrict :: SourceStrictnessQ
- isStrict :: Q Strict
- notStrict :: Q Strict
- unpacked :: Q Strict
- bang :: SourceUnpackednessQ -> SourceStrictnessQ -> BangQ
- bangType :: BangQ -> TypeQ -> BangTypeQ
- varBangType :: Name -> BangTypeQ -> VarBangTypeQ
- strictType :: Q Strict -> TypeQ -> StrictTypeQ
- varStrictType :: Name -> StrictTypeQ -> VarStrictTypeQ
- cxt :: [PredQ] -> CxtQ
- classP :: Name -> [Q Type] -> Q Pred
- equalP :: TypeQ -> TypeQ -> PredQ
- normalC :: Name -> [BangTypeQ] -> ConQ
- recC :: Name -> [VarBangTypeQ] -> ConQ
- infixC :: Q (Bang, Type) -> Name -> Q (Bang, Type) -> ConQ
- forallC :: [TyVarBndr] -> CxtQ -> ConQ -> ConQ
- gadtC :: [Name] -> [StrictTypeQ] -> TypeQ -> ConQ
- recGadtC :: [Name] -> [VarStrictTypeQ] -> TypeQ -> ConQ
- 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
- nominalR :: Role
- representationalR :: Role
- phantomR :: Role
- inferR :: Role
- valD :: PatQ -> BodyQ -> [DecQ] -> DecQ
- funD :: Name -> [ClauseQ] -> DecQ
- tySynD :: Name -> [TyVarBndr] -> TypeQ -> DecQ
- dataD :: CxtQ -> Name -> [TyVarBndr] -> Maybe Kind -> [ConQ] -> [DerivClauseQ] -> DecQ
- newtypeD :: CxtQ -> Name -> [TyVarBndr] -> Maybe Kind -> ConQ -> [DerivClauseQ] -> DecQ
- derivClause :: Maybe DerivStrategy -> [PredQ] -> DerivClauseQ
- data DerivClause = DerivClause (Maybe DerivStrategy) Cxt
- data DerivStrategy
  - = StockStrategy
  - | AnyclassStrategy
  - | NewtypeStrategy
- classD :: CxtQ -> Name -> [TyVarBndr] -> [FunDep] -> [DecQ] -> DecQ
- instanceD :: CxtQ -> TypeQ -> [DecQ] -> DecQ
- instanceWithOverlapD :: Maybe Overlap -> CxtQ -> TypeQ -> [DecQ] -> DecQ
- data Overlap
  - = Overlappable
  - | Overlapping
  - | Overlaps
  - | Incoherent
- sigD :: Name -> TypeQ -> DecQ
- standaloneDerivD :: CxtQ -> TypeQ -> DecQ
- standaloneDerivWithStrategyD :: Maybe DerivStrategy -> CxtQ -> TypeQ -> DecQ
- defaultSigD :: Name -> TypeQ -> DecQ
- roleAnnotD :: Name -> [Role] -> DecQ
- dataFamilyD :: Name -> [TyVarBndr] -> Maybe Kind -> DecQ
- openTypeFamilyD :: Name -> [TyVarBndr] -> FamilyResultSig -> Maybe InjectivityAnn -> DecQ
- closedTypeFamilyD :: Name -> [TyVarBndr] -> FamilyResultSig -> Maybe InjectivityAnn -> [TySynEqnQ] -> DecQ
- dataInstD :: CxtQ -> Name -> [TypeQ] -> Maybe Kind -> [ConQ] -> [DerivClauseQ] -> DecQ
- familyNoKindD :: FamFlavour -> Name -> [TyVarBndr] -> DecQ
- familyKindD :: FamFlavour -> Name -> [TyVarBndr] -> Kind -> DecQ
- closedTypeFamilyNoKindD :: Name -> [TyVarBndr] -> [TySynEqnQ] -> DecQ
- closedTypeFamilyKindD :: Name -> [TyVarBndr] -> Kind -> [TySynEqnQ] -> DecQ
- newtypeInstD :: CxtQ -> Name -> [TypeQ] -> Maybe Kind -> ConQ -> [DerivClauseQ] -> DecQ
- tySynInstD :: Name -> TySynEqnQ -> DecQ
- typeFam :: FamFlavour
- dataFam :: FamFlavour
- tySynEqn :: [TypeQ] -> TypeQ -> TySynEqnQ
- injectivityAnn :: Name -> [Name] -> InjectivityAnn
- noSig :: FamilyResultSig
- kindSig :: Kind -> FamilyResultSig
- tyVarSig :: TyVarBndr -> FamilyResultSig
- infixLD :: Int -> Name -> DecQ
- infixRD :: Int -> Name -> DecQ
- infixND :: Int -> Name -> DecQ
- cCall :: Callconv
- stdCall :: Callconv
- cApi :: Callconv
- prim :: Callconv
- javaScript :: Callconv
- unsafe :: Safety
- safe :: Safety
- interruptible :: Safety
- forImpD :: Callconv -> Safety -> String -> Name -> TypeQ -> DecQ
- funDep :: [Name] -> [Name] -> FunDep
- ruleVar :: Name -> RuleBndrQ
- typedRuleVar :: Name -> TypeQ -> RuleBndrQ
- valueAnnotation :: Name -> AnnTarget
- typeAnnotation :: Name -> AnnTarget
- moduleAnnotation :: AnnTarget
- pragInlD :: Name -> Inline -> RuleMatch -> Phases -> DecQ
- pragSpecD :: Name -> TypeQ -> Phases -> DecQ
- pragSpecInlD :: Name -> TypeQ -> Inline -> Phases -> DecQ
- pragSpecInstD :: TypeQ -> DecQ
- pragRuleD :: String -> [RuleBndrQ] -> ExpQ -> ExpQ -> Phases -> DecQ
- pragAnnD :: AnnTarget -> ExpQ -> DecQ
- pragLineD :: Int -> String -> DecQ
- pragCompleteD :: [Name] -> Maybe Name -> DecQ
- patSynD :: Name -> PatSynArgsQ -> PatSynDirQ -> PatQ -> DecQ
- patSynSigD :: Name -> TypeQ -> DecQ
- unidir :: PatSynDirQ
- implBidir :: PatSynDirQ
- explBidir :: [ClauseQ] -> PatSynDirQ
- prefixPatSyn :: [Name] -> PatSynArgsQ
- infixPatSyn :: Name -> Name -> PatSynArgsQ
- recordPatSyn :: [Name] -> PatSynArgsQ
- thisModule :: Q Module

# Library functions

## Abbreviations

type InfoQ = Q Info #

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

## Constructors lifted to `Q`

### Literals

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 #

### Patterns

litP :: Lit -> PatQ #

varP :: Name -> PatQ #

tupP :: [PatQ] -> PatQ #

unboxedTupP :: [PatQ] -> PatQ #

unboxedSumP :: PatQ -> SumAlt -> SumArity -> PatQ #

conP :: Name -> [PatQ] -> PatQ #

uInfixP :: PatQ -> Name -> PatQ -> PatQ #

parensP :: PatQ -> PatQ #

infixP :: PatQ -> Name -> PatQ -> PatQ #

tildeP :: PatQ -> PatQ #

bangP :: PatQ -> PatQ #

asP :: Name -> PatQ -> PatQ #

wildP :: PatQ #

recP :: Name -> [FieldPatQ] -> PatQ #

listP :: [PatQ] -> PatQ #

sigP :: PatQ -> TypeQ -> PatQ #

viewP :: ExpQ -> PatQ -> PatQ #

fieldPat :: Name -> PatQ -> FieldPatQ #

### Pattern Guards

normalB :: ExpQ -> BodyQ #

guardedB :: [Q (Guard, Exp)] -> BodyQ #

normalG :: ExpQ -> GuardQ #

normalGE :: ExpQ -> ExpQ -> Q (Guard, Exp) #

patG :: [StmtQ] -> GuardQ #

patGE :: [StmtQ] -> ExpQ -> Q (Guard, Exp) #

match :: PatQ -> BodyQ -> [DecQ] -> MatchQ #

Use with `caseE`

clause :: [PatQ] -> BodyQ -> [DecQ] -> ClauseQ #

Use with `funD`

### Expressions

dyn :: String -> ExpQ #

Dynamically binding a variable (unhygenic)

varE :: Name -> ExpQ #

unboundVarE :: Name -> ExpQ #

conE :: Name -> ExpQ #

litE :: Lit -> ExpQ #

appE :: ExpQ -> ExpQ -> ExpQ #

appTypeE :: ExpQ -> TypeQ -> ExpQ #

uInfixE :: ExpQ -> ExpQ -> ExpQ -> ExpQ #

parensE :: ExpQ -> ExpQ #

staticE :: ExpQ -> ExpQ #

    staticE x = [| static x |]

infixE :: Maybe ExpQ -> ExpQ -> Maybe ExpQ -> ExpQ #

infixApp :: ExpQ -> ExpQ -> ExpQ -> ExpQ #

sectionL :: ExpQ -> ExpQ -> ExpQ #

sectionR :: ExpQ -> ExpQ -> ExpQ #

lamE :: [PatQ] -> ExpQ -> ExpQ #

lam1E :: PatQ -> ExpQ -> ExpQ #

Single-arg lambda

lamCaseE :: [MatchQ] -> ExpQ #

tupE :: [ExpQ] -> ExpQ #

unboxedTupE :: [ExpQ] -> ExpQ #

unboxedSumE :: ExpQ -> SumAlt -> SumArity -> ExpQ #

condE :: ExpQ -> ExpQ -> ExpQ -> ExpQ #

multiIfE :: [Q (Guard, Exp)] -> ExpQ #

letE :: [DecQ] -> ExpQ -> ExpQ #

caseE :: ExpQ -> [MatchQ] -> ExpQ #

appsE :: [ExpQ] -> ExpQ #

listE :: [ExpQ] -> ExpQ #

sigE :: ExpQ -> TypeQ -> ExpQ #

recConE :: Name -> [Q (Name, Exp)] -> ExpQ #

recUpdE :: ExpQ -> [Q (Name, Exp)] -> ExpQ #

stringE :: String -> ExpQ #

fieldExp :: Name -> ExpQ -> Q (Name, Exp) #

#### Ranges

fromE :: ExpQ -> ExpQ #

fromThenE :: ExpQ -> ExpQ -> ExpQ #

fromToE :: ExpQ -> ExpQ -> ExpQ #

fromThenToE :: ExpQ -> ExpQ -> ExpQ -> ExpQ #

#### Ranges with more indirection

arithSeqE :: RangeQ -> ExpQ #

fromR :: ExpQ -> RangeQ #

fromThenR :: ExpQ -> ExpQ -> RangeQ #

fromToR :: ExpQ -> ExpQ -> RangeQ #

fromThenToR :: ExpQ -> ExpQ -> ExpQ -> RangeQ #

#### Statements

doE :: [StmtQ] -> ExpQ #

compE :: [StmtQ] -> ExpQ #

bindS :: PatQ -> ExpQ -> StmtQ #

letS :: [DecQ] -> StmtQ #

noBindS :: ExpQ -> StmtQ #

parS :: [[StmtQ]] -> StmtQ #

### Types

forallT :: [TyVarBndr] -> CxtQ -> TypeQ -> TypeQ #

varT :: Name -> TypeQ #

conT :: Name -> TypeQ #

appT :: TypeQ -> TypeQ -> TypeQ #

arrowT :: TypeQ #

infixT :: TypeQ -> Name -> TypeQ -> TypeQ #

uInfixT :: TypeQ -> Name -> TypeQ -> TypeQ #

parensT :: TypeQ -> TypeQ #

equalityT :: TypeQ #

listT :: TypeQ #

tupleT :: Int -> TypeQ #

unboxedTupleT :: Int -> TypeQ #

unboxedSumT :: SumArity -> TypeQ #

sigT :: TypeQ -> Kind -> TypeQ #

litT :: TyLitQ -> TypeQ #

wildCardT :: TypeQ #

promotedT :: Name -> TypeQ #

promotedTupleT :: Int -> TypeQ #

promotedNilT :: TypeQ #

promotedConsT :: TypeQ #

#### Type literals

numTyLit :: Integer -> TyLitQ #

strTyLit :: String -> TyLitQ #

#### Strictness

noSourceUnpackedness :: SourceUnpackednessQ #

sourceNoUnpack :: SourceUnpackednessQ #

sourceUnpack :: SourceUnpackednessQ #

noSourceStrictness :: SourceStrictnessQ #

sourceLazy :: SourceStrictnessQ #

sourceStrict :: SourceStrictnessQ #

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'

bang :: SourceUnpackednessQ -> SourceStrictnessQ -> BangQ #

bangType :: BangQ -> TypeQ -> BangTypeQ #

varBangType :: Name -> BangTypeQ -> VarBangTypeQ #

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.

#### Class Contexts

cxt :: [PredQ] -> CxtQ #

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

#### Constructors

normalC :: Name -> [BangTypeQ] -> ConQ #

recC :: Name -> [VarBangTypeQ] -> ConQ #

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

forallC :: [TyVarBndr] -> CxtQ -> ConQ -> ConQ #

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

recGadtC :: [Name] -> [VarStrictTypeQ] -> TypeQ -> ConQ #

### Kinds

varK :: Name -> Kind #

conK :: Name -> Kind #

tupleK :: Int -> Kind #

arrowK :: Kind #

listK :: Kind #

appK :: Kind -> Kind -> Kind #

starK :: Kind #

constraintK :: Kind #

### Type variable binders

plainTV :: Name -> TyVarBndr #

kindedTV :: Name -> Kind -> TyVarBndr #

### Roles

nominalR :: Role #

representationalR :: Role #

phantomR :: Role #

inferR :: Role #

### Top Level Declarations

#### Data

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

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

tySynD :: Name -> [TyVarBndr] -> TypeQ -> DecQ #

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

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

derivClause :: Maybe DerivStrategy -> [PredQ] -> DerivClauseQ #

data DerivClause #

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

Constructors

DerivClause (Maybe DerivStrategy) Cxt

    { deriving stock (Eq, Ord) }

Instances

Eq DerivClause # |
Methods (==) :: DerivClause -> DerivClause -> Bool # (/=) :: DerivClause -> DerivClause -> Bool #
Data DerivClause # |

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 :: (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 # |
Methods compare :: DerivClause -> DerivClause -> Ordering # (<) :: DerivClause -> DerivClause -> Bool # (<=) :: DerivClause -> DerivClause -> Bool # (>) :: DerivClause -> DerivClause -> Bool # (>=) :: DerivClause -> DerivClause -> Bool # max :: DerivClause -> DerivClause -> DerivClause # min :: DerivClause -> DerivClause -> DerivClause #
Show DerivClause # |
Methods showsPrec :: Int -> DerivClause -> ShowS Source # show :: DerivClause -> String Source # showList :: [DerivClause] -> ShowS Source #
Generic DerivClause # |
Associated Types type Rep DerivClause :: * -> * Source # Methods from :: DerivClause -> Rep DerivClause x Source # to :: Rep DerivClause x -> DerivClause Source #
type Rep DerivClause # |
type Rep DerivClause = D1 * (MetaData "DerivClause" "Language.Haskell.TH.Syntax" "template-haskell" False) (C1 * (MetaCons "DerivClause" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe DerivStrategy))) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Cxt))))

data DerivStrategy #

What the user explicitly requests when deriving an instance.

Constructors

StockStrategy | A "standard" derived instance

AnyclassStrategy

    -XDeriveAnyClass

NewtypeStrategy

    -XGeneralizedNewtypeDeriving

Instances

Eq DerivStrategy # |
Methods (==) :: DerivStrategy -> DerivStrategy -> Bool # (/=) :: DerivStrategy -> DerivStrategy -> Bool #
Data DerivStrategy # |

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 :: (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 # |
Methods compare :: DerivStrategy -> DerivStrategy -> Ordering # (<) :: DerivStrategy -> DerivStrategy -> Bool # (<=) :: DerivStrategy -> DerivStrategy -> Bool # (>) :: DerivStrategy -> DerivStrategy -> Bool # (>=) :: DerivStrategy -> DerivStrategy -> Bool # max :: DerivStrategy -> DerivStrategy -> DerivStrategy # min :: DerivStrategy -> DerivStrategy -> DerivStrategy #
Show DerivStrategy # |
Methods showsPrec :: Int -> DerivStrategy -> ShowS Source # show :: DerivStrategy -> String Source # showList :: [DerivStrategy] -> ShowS Source #
Generic DerivStrategy # |
Associated Types type Rep DerivStrategy :: * -> * Source # Methods from :: DerivStrategy -> Rep DerivStrategy x Source # to :: Rep DerivStrategy x -> DerivStrategy Source #
type Rep DerivStrategy # |
type Rep DerivStrategy = D1 * (MetaData "DerivStrategy" "Language.Haskell.TH.Syntax" "template-haskell" False) ((:+:) * (C1 * (MetaCons "StockStrategy" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "AnyclassStrategy" PrefixI False) (U1 *)) (C1 * (MetaCons "NewtypeStrategy" PrefixI False) (U1 *))))

#### Class

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

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

instanceWithOverlapD :: Maybe Overlap -> CxtQ -> TypeQ -> [DecQ] -> DecQ #

data Overlap #

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

Eq Overlap # |
Methods (==) :: Overlap -> Overlap -> Bool # (/=) :: Overlap -> Overlap -> Bool #
Data Overlap # |

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 :: (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 # |
Methods compare :: Overlap -> Overlap -> Ordering # (<) :: Overlap -> Overlap -> Bool # (<=) :: Overlap -> Overlap -> Bool # (>) :: Overlap -> Overlap -> Bool # (>=) :: Overlap -> Overlap -> Bool # max :: Overlap -> Overlap -> Overlap # min :: Overlap -> Overlap -> Overlap #
Show Overlap # |
Methods showsPrec :: Int -> Overlap -> ShowS Source # show :: Overlap -> String Source # showList :: [Overlap] -> ShowS Source #
Generic Overlap # |
Associated Types type Rep Overlap :: * -> * Source # Methods from :: Overlap -> Rep Overlap x Source # to :: Rep Overlap x -> Overlap Source #
type Rep Overlap # |
type Rep Overlap = D1 * (MetaData "Overlap" "Language.Haskell.TH.Syntax" "template-haskell" 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 *))))

sigD :: Name -> TypeQ -> DecQ #

standaloneDerivD :: CxtQ -> TypeQ -> DecQ #

standaloneDerivWithStrategyD :: Maybe DerivStrategy -> CxtQ -> TypeQ -> DecQ #

defaultSigD :: Name -> TypeQ -> DecQ #

#### Role annotations

roleAnnotD :: Name -> [Role] -> DecQ #

#### Type Family / Data Family

dataFamilyD :: Name -> [TyVarBndr] -> Maybe Kind -> DecQ #

openTypeFamilyD :: Name -> [TyVarBndr] -> FamilyResultSig -> Maybe InjectivityAnn -> DecQ #

closedTypeFamilyD :: Name -> [TyVarBndr] -> FamilyResultSig -> Maybe InjectivityAnn -> [TySynEqnQ] -> DecQ #

dataInstD :: CxtQ -> Name -> [TypeQ] -> Maybe Kind -> [ConQ] -> [DerivClauseQ] -> 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.

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

tySynInstD :: Name -> TySynEqnQ -> DecQ #

typeFam :: FamFlavour #

dataFam :: FamFlavour #

tySynEqn :: [TypeQ] -> TypeQ -> TySynEqnQ #

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

noSig :: FamilyResultSig #

kindSig :: Kind -> FamilyResultSig #

tyVarSig :: TyVarBndr -> FamilyResultSig #

#### Fixity

infixLD :: Int -> Name -> DecQ #

infixRD :: Int -> Name -> DecQ #

infixND :: Int -> Name -> DecQ #

#### Foreign Function Interface (FFI)

cCall :: Callconv #

stdCall :: Callconv #

cApi :: Callconv #

prim :: Callconv #

javaScript :: Callconv #

unsafe :: Safety #

safe :: Safety #

interruptible :: Safety #

forImpD :: Callconv -> Safety -> String -> Name -> TypeQ -> DecQ #

#### Functional dependencies

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

#### Pragmas

ruleVar :: Name -> RuleBndrQ #

typedRuleVar :: Name -> TypeQ -> RuleBndrQ #

valueAnnotation :: Name -> AnnTarget #

typeAnnotation :: Name -> AnnTarget #

moduleAnnotation :: AnnTarget #

pragInlD :: Name -> Inline -> RuleMatch -> Phases -> DecQ #

pragSpecD :: Name -> TypeQ -> Phases -> DecQ #

pragSpecInlD :: Name -> TypeQ -> Inline -> Phases -> DecQ #

pragSpecInstD :: TypeQ -> DecQ #

pragRuleD :: String -> [RuleBndrQ] -> ExpQ -> ExpQ -> Phases -> DecQ #

pragAnnD :: AnnTarget -> ExpQ -> DecQ #

pragLineD :: Int -> String -> DecQ #

pragCompleteD :: [Name] -> Maybe Name -> DecQ #

#### Pattern Synonyms

patSynD :: Name -> PatSynArgsQ -> PatSynDirQ -> PatQ -> DecQ #

Pattern synonym declaration

patSynSigD :: Name -> TypeQ -> DecQ #

Pattern synonym type signature

unidir :: PatSynDirQ #

implBidir :: PatSynDirQ #

explBidir :: [ClauseQ] -> PatSynDirQ #

prefixPatSyn :: [Name] -> PatSynArgsQ #

infixPatSyn :: Name -> Name -> PatSynArgsQ #

recordPatSyn :: [Name] -> PatSynArgsQ #

## Reify

thisModule :: Q Module #

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