ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions
Safe HaskellIgnore
LanguageGHC2021

Language.Haskell.TH.Lib

Description

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

Synopsis

Library functions

Abbreviations

type InfoQ = Q Info #

type ExpQ = Q Exp #

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

Representation-polymorphic since template-haskell-2.17.0.0.

type CodeQ = Code Q #

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 MatchQ = Q Match #

type ClauseQ = Q Clause #

type BodyQ = Q Body #

type GuardQ = Q Guard #

type StmtQ = Q Stmt #

type RangeQ = Q Range #

type BangQ = Q Bang #

type PatQ = Q Pat #

Constructors lifted to Q

Literals

charL :: Char -> Lit #

mkBytes #

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

Patterns

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 #

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

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

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

Pattern Guards

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 #

Use with caseE

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

Use with funD

Expressions

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

Dynamically binding a variable (unhygienic)

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

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

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

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

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

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

staticE x = [| static x |]

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 #

Single-arg lambda

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

Lambda-case (case)

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

Lambda-cases (cases)

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

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

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

typedBracketE :: Quote m => m Exp -> m Exp #

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

Ranges

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 #

Ranges with more indirection

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 #

Statements

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 #

Types

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 #

mulArrowT :: Quote m => m Type #

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

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

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

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

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 #

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

Type literals

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

charTyLit :: Quote m => Char -> m TyLit #

Strictness

isStrict :: Quote m => m Strict #

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

notStrict :: Quote m => m Strict #

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

unpacked :: Quote m => m Strict #

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 #

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

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 #

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 #

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

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 #

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 #

Kinds

varK :: Name -> Kind #

conK :: Name -> Kind #

appK :: Kind -> Kind -> Kind #

Type variable binders

class DefaultBndrFlag flag where #

Methods

defaultBndrFlag :: flag #

Instances

Instances details
DefaultBndrFlag BndrVis # 
Instance details

Defined in Language.Haskell.TH.Lib

DefaultBndrFlag Specificity # 
Instance details

Defined in Language.Haskell.TH.Lib

DefaultBndrFlag () # 
Instance details

Defined in Language.Haskell.TH.Lib

Methods

defaultBndrFlag :: () #

Roles

Top Level Declarations

Data

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

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

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

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

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

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

data DerivClause #

A single deriving clause at the end of a datatype.

Constructors

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

Instances

Instances details
Binary DerivClause # 
Instance details

Defined in GHCi.TH.Binary

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 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DerivClause #

toConstr :: DerivClause -> Constr #

dataTypeOf :: DerivClause -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DerivClause) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DerivClause) #

gmapT :: (forall b. Data b => b -> b) -> DerivClause -> DerivClause #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DerivClause -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DerivClause -> r #

gmapQ :: (forall d. Data d => d -> u) -> DerivClause -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> DerivClause -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> DerivClause -> m DerivClause #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivClause -> m DerivClause #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivClause -> m DerivClause #

Generic DerivClause # 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep DerivClause 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep DerivClause = D1 ('MetaData "DerivClause" "Language.Haskell.TH.Syntax" "ghc-lib-parser-9.10.1.20250103-FaHJOkjTl0Y9STmjhYbIHo" '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)))
Show DerivClause # 
Instance details

Defined in Language.Haskell.TH.Syntax

Eq DerivClause # 
Instance details

Defined in Language.Haskell.TH.Syntax

Ord DerivClause # 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep DerivClause # 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep DerivClause = D1 ('MetaData "DerivClause" "Language.Haskell.TH.Syntax" "ghc-lib-parser-9.10.1.20250103-FaHJOkjTl0Y9STmjhYbIHo" '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)))

data DerivStrategy #

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
Binary DerivStrategy # 
Instance details

Defined in GHCi.TH.Binary

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 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DerivStrategy #

toConstr :: DerivStrategy -> Constr #

dataTypeOf :: DerivStrategy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DerivStrategy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DerivStrategy) #

gmapT :: (forall b. Data b => b -> b) -> DerivStrategy -> DerivStrategy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DerivStrategy -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DerivStrategy -> r #

gmapQ :: (forall d. Data d => d -> u) -> DerivStrategy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> DerivStrategy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> DerivStrategy -> m DerivStrategy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivStrategy -> m DerivStrategy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DerivStrategy -> m DerivStrategy #

Generic DerivStrategy # 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep DerivStrategy 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep DerivStrategy = D1 ('MetaData "DerivStrategy" "Language.Haskell.TH.Syntax" "ghc-lib-parser-9.10.1.20250103-FaHJOkjTl0Y9STmjhYbIHo" '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))))
Show DerivStrategy # 
Instance details

Defined in Language.Haskell.TH.Syntax

Eq DerivStrategy # 
Instance details

Defined in Language.Haskell.TH.Syntax

Ord DerivStrategy # 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep DerivStrategy # 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep DerivStrategy = D1 ('MetaData "DerivStrategy" "Language.Haskell.TH.Syntax" "ghc-lib-parser-9.10.1.20250103-FaHJOkjTl0Y9STmjhYbIHo" '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 BndrVis] -> [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 #

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 Overlapping and Overlappable, and pick an arbitrary one if multiple choices are available.

Instances

Instances details
Binary Overlap # 
Instance details

Defined in GHCi.TH.Binary

Methods

put :: Overlap -> Put #

get :: Get Overlap #

putList :: [Overlap] -> Put #

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 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Overlap #

toConstr :: Overlap -> Constr #

dataTypeOf :: Overlap -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Overlap) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Overlap) #

gmapT :: (forall b. Data b => b -> b) -> Overlap -> Overlap #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Overlap -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Overlap -> r #

gmapQ :: (forall d. Data d => d -> u) -> Overlap -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Overlap -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Overlap -> m Overlap #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Overlap -> m Overlap #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Overlap -> m Overlap #

Generic Overlap # 
Instance details

Defined in Language.Haskell.TH.Syntax

Associated Types

type Rep Overlap 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep Overlap = D1 ('MetaData "Overlap" "Language.Haskell.TH.Syntax" "ghc-lib-parser-9.10.1.20250103-FaHJOkjTl0Y9STmjhYbIHo" '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)))

Methods

from :: Overlap -> Rep Overlap x #

to :: Rep Overlap x -> Overlap #

Show Overlap # 
Instance details

Defined in Language.Haskell.TH.Syntax

Eq Overlap # 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

(==) :: Overlap -> Overlap -> Bool #

(/=) :: Overlap -> Overlap -> Bool #

Ord Overlap # 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep Overlap # 
Instance details

Defined in Language.Haskell.TH.Syntax

type Rep Overlap = D1 ('MetaData "Overlap" "Language.Haskell.TH.Syntax" "ghc-lib-parser-9.10.1.20250103-FaHJOkjTl0Y9STmjhYbIHo" '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 #

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

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

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

Role annotations

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

Type Family / Data Family

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 #

Fixity

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

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

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

Default declaration

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

Foreign Function Interface (FFI)

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

Functional dependencies

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

Pragmas

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

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

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 #

Pattern Synonyms

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

Pattern synonym declaration

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

Pattern synonym type signature

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

Implicit Parameters

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

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

Reify

thisModule :: Q Module #

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

Documentation

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

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

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

funD_doc #

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 #

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 #

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 #

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 #

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 #

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 #

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.