Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility functions for working with TH
Synopsis
- appsT :: Q Type -> [Q Type] -> Q Type
- arrT :: [Q Type] -> Q Type -> Q Type
- vectorE :: (a -> Q Exp) -> [a] -> Q Exp
- plistT :: [Q Type] -> Q Type
- ptupleT :: [Q Type] -> Q Type
- simpleFn :: Name 'VarName flavour -> Q Type -> Q Exp -> Q [Dec]
- simplePatSynType :: [TyVarBndr] -> [Q Type] -> Q Type -> Q PatSynType
- tyVarName :: TyVarBndr -> Name
- tyVarType :: TyVarBndr -> Q Type
- pattern DefaultBang :: Bang
- requiresExtensions :: Quasi m => [Extension] -> m ()
Folding
appsT :: Q Type -> [Q Type] -> Q Type Source #
Repeated application
appsT f [x1, .., xN]
constructs something like
f x1 .. xN
arrT :: [Q Type] -> Q Type -> Q Type Source #
Repeated application of (->)
arrT [x1, .., xN] y
constructs something like
x1 -> .. -> xN -> y
Constructing lists (variations on listE
)
Simplified construction
simpleFn :: Name 'VarName flavour -> Q Type -> Q Exp -> Q [Dec] Source #
Construct simple function
simpleFn n typ body
constructs something like
f :: typ f = body
simplePatSynType :: [TyVarBndr] -> [Q Type] -> Q Type -> Q PatSynType Source #
Construct simple pattern synonym type
simplePatSynType xs [t1, .., tn] s
constructs something like
pattern foo :: forall xs. t1 -> .. -> tn -> s
Dealing with type variables
Bang
pattern DefaultBang :: Bang Source #
Extensions
requiresExtensions :: Quasi m => [Extension] -> m () Source #
Check that the specified extensions are enabled
To improve user experience, we report all missing extensions at once (rather than giving an error for the first missing one).