Language.Haskell.TH.Lib
Language.Haskell.TH.Lib contains lots of useful helper functions for generating and manipulating Template Haskell terms
Library functions
Abbreviations
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 DerivClauseQ = Q DerivClause Source #
type SourceStrictnessQ = Q SourceStrictness Source #
type VarBangTypeQ = Q VarBangType Source #
type StrictTypeQ = Q StrictType Source #
type VarStrictTypeQ = Q VarStrictType 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
floatPrimL :: Rational -> Lit Source #
doublePrimL :: Rational -> Lit Source #
stringPrimL :: [Word8] -> Lit Source #
bytesPrimL :: Bytes -> Lit 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
Pattern Guards
Expressions
Ranges
Ranges with more indirection
Statements
Types
promotedNilT :: Quote m => m Type Source #
promotedConsT :: Quote m => m Type Source #
Type literals
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 #
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
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
Kinds
constraintK :: Kind Source #
Type variable binders
plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity) Source #
kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity) Source #
Roles
Top Level Declarations
Data
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
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
Class
Varieties of allowed instance overlap.
Constructors
Overlappable | May be overlapped by more specific instances |
Overlapping | May overlap a more general instance |
Overlaps | Both |
Incoherent | Both |
Instances
Data Overlap Source # | |
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 # | |
Generic Overlap Source # | |
Show Overlap Source # | |
Eq Overlap Source # | |
Ord Overlap Source # | |
Defined in Language.Haskell.TH.Syntax | |
type Rep Overlap Source # | |
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))) |
standaloneDerivWithStrategyD :: Quote m => Maybe DerivStrategy -> m Cxt -> m Type -> m Dec Source #
Role annotations
Type Family / Data Family
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 #
injectivityAnn :: Name -> [Name] -> InjectivityAnn Source #
kindSig :: Kind -> FamilyResultSig Source #
tyVarSig :: TyVarBndr () -> FamilyResultSig Source #
Fixity
Foreign Function Interface (FFI)
Functional dependencies
Pragmas
valueAnnotation :: Name -> AnnTarget Source #
typeAnnotation :: Name -> AnnTarget Source #
Pattern Synonyms
patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec Source #
Pattern synonym declaration
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
.