-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Support library for Template Haskell -- -- This package provides modules containing facilities for manipulating -- Haskell source code using Template Haskell. -- -- See http://www.haskell.org/haskellwiki/Template_Haskell for -- more information. @package template-haskell @version 2.22.0.0 -- | Language extensions known to GHC module Language.Haskell.TH.LanguageExtensions -- | The language extensions known to GHC. -- -- Note that there is an orphan Binary instance for this type -- supplied by the GHC.LanguageExtensions module provided by -- ghc-boot. We can't provide here as this would require adding -- transitive dependencies to the template-haskell package, -- which must have a minimal dependency set. data Extension Cpp :: Extension OverlappingInstances :: Extension UndecidableInstances :: Extension IncoherentInstances :: Extension UndecidableSuperClasses :: Extension MonomorphismRestriction :: Extension MonoLocalBinds :: Extension DeepSubsumption :: Extension RelaxedPolyRec :: Extension ExtendedDefaultRules :: Extension ForeignFunctionInterface :: Extension UnliftedFFITypes :: Extension InterruptibleFFI :: Extension CApiFFI :: Extension GHCForeignImportPrim :: Extension JavaScriptFFI :: Extension ParallelArrays :: Extension Arrows :: Extension TemplateHaskell :: Extension TemplateHaskellQuotes :: Extension QualifiedDo :: Extension QuasiQuotes :: Extension ImplicitParams :: Extension ImplicitPrelude :: Extension ScopedTypeVariables :: Extension AllowAmbiguousTypes :: Extension UnboxedTuples :: Extension UnboxedSums :: Extension UnliftedNewtypes :: Extension UnliftedDatatypes :: Extension BangPatterns :: Extension TypeFamilies :: Extension TypeFamilyDependencies :: Extension TypeInType :: Extension OverloadedStrings :: Extension OverloadedLists :: Extension NumDecimals :: Extension DisambiguateRecordFields :: Extension RecordWildCards :: Extension NamedFieldPuns :: Extension ViewPatterns :: Extension GADTs :: Extension GADTSyntax :: Extension NPlusKPatterns :: Extension DoAndIfThenElse :: Extension BlockArguments :: Extension RebindableSyntax :: Extension ConstraintKinds :: Extension PolyKinds :: Extension DataKinds :: Extension TypeData :: Extension InstanceSigs :: Extension ApplicativeDo :: Extension LinearTypes :: Extension RequiredTypeArguments :: Extension StandaloneDeriving :: Extension DeriveDataTypeable :: Extension AutoDeriveTypeable :: Extension DeriveFunctor :: Extension DeriveTraversable :: Extension DeriveFoldable :: Extension DeriveGeneric :: Extension DefaultSignatures :: Extension DeriveAnyClass :: Extension DeriveLift :: Extension DerivingStrategies :: Extension DerivingVia :: Extension TypeSynonymInstances :: Extension FlexibleContexts :: Extension FlexibleInstances :: Extension ConstrainedClassMethods :: Extension MultiParamTypeClasses :: Extension NullaryTypeClasses :: Extension FunctionalDependencies :: Extension UnicodeSyntax :: Extension ExistentialQuantification :: Extension MagicHash :: Extension EmptyDataDecls :: Extension KindSignatures :: Extension RoleAnnotations :: Extension ParallelListComp :: Extension TransformListComp :: Extension MonadComprehensions :: Extension GeneralizedNewtypeDeriving :: Extension RecursiveDo :: Extension PostfixOperators :: Extension TupleSections :: Extension PatternGuards :: Extension LiberalTypeSynonyms :: Extension RankNTypes :: Extension ImpredicativeTypes :: Extension TypeOperators :: Extension ExplicitNamespaces :: Extension PackageImports :: Extension ExplicitForAll :: Extension AlternativeLayoutRule :: Extension AlternativeLayoutRuleTransitional :: Extension DatatypeContexts :: Extension NondecreasingIndentation :: Extension RelaxedLayout :: Extension TraditionalRecordSyntax :: Extension LambdaCase :: Extension MultiWayIf :: Extension BinaryLiterals :: Extension NegativeLiterals :: Extension HexFloatLiterals :: Extension DuplicateRecordFields :: Extension OverloadedLabels :: Extension EmptyCase :: Extension PatternSynonyms :: Extension PartialTypeSignatures :: Extension NamedWildCards :: Extension StaticPointers :: Extension TypeApplications :: Extension Strict :: Extension StrictData :: Extension EmptyDataDeriving :: Extension NumericUnderscores :: Extension QuantifiedConstraints :: Extension StarIsType :: Extension ImportQualifiedPost :: Extension CUSKs :: Extension StandaloneKindSignatures :: Extension LexicalNegation :: Extension FieldSelectors :: Extension OverloadedRecordDot :: Extension OverloadedRecordUpdate :: Extension TypeAbstractions :: Extension ExtendedLiterals :: Extension ListTuplePuns :: Extension -- | Abstract syntax definitions for Template Haskell. module Language.Haskell.TH.Syntax data Foreign ImportF :: Callconv -> Safety -> String -> Name -> Type -> Foreign ExportF :: Callconv -> String -> Name -> Type -> Foreign data Type -- |
--   forall <vars>. <ctxt> => <type>
--   
ForallT :: [TyVarBndr Specificity] -> Cxt -> Type -> Type -- |
--   forall <vars> -> <type>
--   
ForallVisT :: [TyVarBndr ()] -> Type -> Type -- |
--   T a b
--   
AppT :: Type -> Type -> Type -- |
--   T @k t
--   
AppKindT :: Type -> Kind -> Type -- |
--   t :: k
--   
SigT :: Type -> Kind -> Type -- |
--   a
--   
VarT :: Name -> Type -- |
--   T
--   
ConT :: Name -> Type -- |
--   'T
--   
PromotedT :: Name -> Type -- |
--   T + T
--   
InfixT :: Type -> Name -> Type -> Type -- |
--   T + T
--   
-- -- See Language.Haskell.TH.Syntax#infix UInfixT :: Type -> Name -> Type -> Type -- |
--   T :+: T
--   
PromotedInfixT :: Type -> Name -> Type -> Type -- |
--   T :+: T
--   
-- -- See Language.Haskell.TH.Syntax#infix PromotedUInfixT :: Type -> Name -> Type -> Type -- |
--   (T)
--   
ParensT :: Type -> Type -- | (,), (,,), etc. TupleT :: Int -> Type -- | (#,#), (#,,#), etc. UnboxedTupleT :: Int -> Type -- | (#|#), (#||#), etc. UnboxedSumT :: SumArity -> Type -- |
--   ->
--   
ArrowT :: Type -- |
--   %n ->
--   
-- -- Generalised arrow type with multiplicity argument MulArrowT :: Type -- |
--   ~
--   
EqualityT :: Type -- |
--   []
--   
ListT :: Type -- | '(), '(,), '(,,), etc. PromotedTupleT :: Int -> Type -- |
--   '[]
--   
PromotedNilT :: Type -- |
--   '(:)
--   
PromotedConsT :: Type -- |
--   *
--   
StarT :: Type -- |
--   Constraint
--   
ConstraintT :: Type -- | 0, 1, 2, etc. LitT :: TyLit -> Type -- |
--   _
--   
WildCardT :: Type -- |
--   ?x :: t
--   
ImplicitParamT :: String -> Type -> Type -- | Obtained from reifyModule and thisModule. data Module Module :: PkgName -> ModName -> Module -- | SourceUnpackedness corresponds to unpack annotations found in -- the source code. -- -- This may not agree with the annotations returned by -- reifyConStrictness. See reifyConStrictness for more -- information. data SourceUnpackedness -- |
--   C a
--   
NoSourceUnpackedness :: SourceUnpackedness -- |
--   C { {-# NOUNPACK #-} } a
--   
SourceNoUnpack :: SourceUnpackedness -- |
--   C { {-# UNPACK #-} } a
--   
SourceUnpack :: SourceUnpackedness -- | SourceStrictness corresponds to strictness annotations found in -- the source code. -- -- This may not agree with the annotations returned by -- reifyConStrictness. See reifyConStrictness for more -- information. data SourceStrictness -- |
--   C a
--   
NoSourceStrictness :: SourceStrictness -- |
--   C {~}a
--   
SourceLazy :: SourceStrictness -- |
--   C {!}a
--   
SourceStrict :: SourceStrictness -- | Unlike SourceStrictness and SourceUnpackedness, -- DecidedStrictness refers to the strictness annotations that the -- compiler chooses for a data constructor field, which may be different -- from what is written in source code. -- -- Note that non-unpacked strict fields are assigned DecidedLazy -- when a bang would be inappropriate, such as the field of a newtype -- constructor and fields that have an unlifted type. -- -- See reifyConStrictness for more information. data DecidedStrictness -- | Field inferred to not have a bang. DecidedLazy :: DecidedStrictness -- | Field inferred to have a bang. DecidedStrict :: DecidedStrictness -- | Field inferred to be unpacked. DecidedUnpack :: DecidedStrictness -- | In PrimTyConI, is the type constructor unlifted? type Unlifted = Bool -- | A Lift instance can have any of its values turned into a -- Template Haskell expression. This is needed when a value used within a -- Template Haskell quotation is bound outside the Oxford brackets -- ([| ... |] or [|| ... ||]) but not at the top level. -- As an example: -- --
--   add1 :: Int -> Code Q Int
--   add1 x = [|| x + 1 ||]
--   
-- -- Template Haskell has no way of knowing what value x will take -- on at splice-time, so it requires the type of x to be an -- instance of Lift. -- -- A Lift instance must satisfy $(lift x) ≡ x and -- $$(liftTyped x) ≡ x for all x, where $(...) -- and $$(...) are Template Haskell splices. It is additionally -- expected that lift x ≡ unTypeCode (liftTyped -- x). -- -- Lift instances can be derived automatically by use of the -- -XDeriveLift GHC language extension: -- --
--   {-# LANGUAGE DeriveLift #-}
--   module Foo where
--   
--   import Language.Haskell.TH.Syntax
--   
--   data Bar a = Bar1 a (Bar a) | Bar2 String
--     deriving Lift
--   
-- -- Representation-polymorphic since template-haskell-2.16.0.0. class Lift (t :: TYPE r) -- | Turn a value into a Template Haskell expression, suitable for use in a -- splice. lift :: (Lift t, Quote m) => t -> m Exp ($dmlift) :: forall m. (Lift t, r ~ LiftedRep, Quote m) => t -> m Exp -- | Turn a value into a Template Haskell typed expression, suitable for -- use in a typed splice. liftTyped :: forall (m :: Type -> Type). (Lift t, Quote m) => t -> Code m t data Fixity Fixity :: Int -> FixityDirection -> Fixity data NameIs Alone :: NameIs Applied :: NameIs Infix :: NameIs -- | A data constructor. -- -- The constructors for Con can roughly be divided up into two -- categories: those for constructors with "vanilla" syntax -- (NormalC, RecC, and InfixC), and those for -- constructors with GADT syntax (GadtC and RecGadtC). The -- ForallC constructor, which quantifies additional type variables -- and class contexts, can surround either variety of constructor. -- However, the type variables that it quantifies are different depending -- on what constructor syntax is used: -- -- -- --
--   data Foo a = forall b. MkFoo a b
--   
--   
-- -- In MkFoo, ForallC will quantify b, but not -- a. -- -- -- --
--   data Bar a b where
--     MkBar :: (a ~ b) => c -> MkBar a b
--   
--   
-- -- In MkBar, ForallC will quantify a, -- b, and c. -- -- Multiplicity annotations for data types are currently not supported in -- Template Haskell (i.e. all fields represented by Template Haskell will -- be linear). data Con -- |
--   C Int a
--   
NormalC :: Name -> [BangType] -> Con -- |
--   C { v :: Int, w :: a }
--   
RecC :: Name -> [VarBangType] -> Con -- |
--   Int :+ a
--   
InfixC :: BangType -> Name -> BangType -> Con -- |
--   forall a. Eq a => C [a]
--   
ForallC :: [TyVarBndr Specificity] -> Cxt -> Con -> Con GadtC :: [Name] -> [BangType] -> Type -> Con -- |
--   C :: { v :: Int } -> T b Int
--   
RecGadtC :: [Name] -> [VarBangType] -> Type -> Con -- | Recover from errors raised by reportError or fail. recover :: Q a -> Q a -> Q a -- | Report an error to the user, but allow the current splice's -- computation to carry on. To abort the computation, use fail. reportError :: String -> Q () -- | The runIO function lets you run an I/O computation in the -- Q monad. Take care: you are guaranteed the ordering of calls to -- runIO within a single Q computation, but not about the -- order in which splices are run. -- -- Note: for various murky reasons, stdout and stderr handles are not -- necessarily flushed when the compiler finishes running, so you should -- flush them yourself. runIO :: IO a -> Q a -- | As of template-haskell-2.11.0.0, Strict has been -- replaced by Bang. type Strict = Bang data Safety Unsafe :: Safety Safe :: Safety Interruptible :: Safety newtype Q a Q :: (forall (m :: Type -> Type). Quasi m => m a) -> Q a [unQ] :: Q a -> forall (m :: Type -> Type). Quasi m => m a runQ :: Quasi m => Q a -> m a -- | The Quote class implements the minimal interface which is -- necessary for desugaring quotations. -- -- -- -- Therefore the type of an untyped quotation in GHC is `Quote m => m -- Exp` -- -- For many years the type of a quotation was fixed to be `Q Exp` but by -- more precisely specifying the minimal interface it enables the -- Exp to be extracted purely from the quotation without -- interacting with Q. class Monad m => Quote (m :: Type -> Type) -- | Generate a fresh name, which cannot be captured. -- -- For example, this: -- --
--   f = $(do
--       nm1 <- newName "x"
--       let nm2 = mkName "x"
--       return (LamE [VarP nm1] (LamE [VarP nm2] (VarE nm1)))
--      )
--   
-- -- will produce the splice -- --
--   f = \x0 -> \x -> x0
--   
-- -- In particular, the occurrence VarE nm1 refers to the binding -- VarP nm1, and is not captured by the binding VarP -- nm2. -- -- Although names generated by newName cannot be -- captured, they can capture other names. For example, this: -- --
--   g = $(do
--     nm1 <- newName "x"
--     let nm2 = mkName "x"
--     return (LamE [VarP nm2] (LamE [VarP nm1] (VarE nm2)))
--    )
--   
-- -- will produce the splice -- --
--   g = \x -> \x0 -> x0
--   
-- -- since the occurrence VarE nm2 is captured by the innermost -- binding of x, namely VarP nm1. newName :: Quote m => String -> m Name -- | Report a warning to the user, and carry on. reportWarning :: String -> Q () -- | Report an error (True) or warning (False), but carry on; use -- fail to stop. -- | Deprecated: Use reportError or reportWarning instead report :: Bool -> String -> Q () -- | The location at which this computation is spliced. location :: Q Loc data Loc Loc :: String -> String -> String -> CharPos -> CharPos -> Loc [loc_filename] :: Loc -> String [loc_package] :: Loc -> String [loc_module] :: Loc -> String [loc_start] :: Loc -> CharPos [loc_end] :: Loc -> CharPos -- | reify looks up information about the Name. It will fail -- with a compile error if the Name is not visible. A Name -- is visible if it is imported or defined in a prior top-level -- declaration group. See the documentation for -- newDeclarationGroup for more details. -- -- It is sometimes useful to construct the argument name using -- lookupTypeName or lookupValueName to ensure that we are -- reifying from the right namespace. For instance, in this context: -- --
--   data D = D
--   
-- -- which D does reify (mkName "D") return information -- about? (Answer: D-the-type, but don't rely on it.) To ensure -- we get information about D-the-value, use -- lookupValueName: -- --
--   do
--     Just nm <- lookupValueName "D"
--     reify nm
--   
-- -- and to get information about D-the-type, use -- lookupTypeName. reify :: Name -> Q Info -- | reifyModule mod looks up information about module -- mod. To look up the current module, call this function with -- the return value of thisModule. reifyModule :: Module -> Q ModuleInfo -- | Template Haskell is capable of reifying information about types and -- terms defined in previous declaration groups. Top-level declaration -- splices break up declaration groups. -- -- For an example, consider this code block. We define a datatype -- X and then try to call reify on the datatype. -- --
--   module Check where
--   
--   data X = X
--       deriving Eq
--   
--   $(do
--       info <- reify ''X
--       runIO $ print info
--    )
--   
-- -- This code fails to compile, noting that X is not available -- for reification at the site of reify. We can fix this by -- creating a new declaration group using an empty top-level splice: -- --
--   data X = X
--       deriving Eq
--   
--   $(pure [])
--   
--   $(do
--       info <- reify ''X
--       runIO $ print info
--    )
--   
-- -- We provide newDeclarationGroup as a means of documenting this -- behavior and providing a name for the pattern. -- -- Since top level splices infer the presence of the $( ... ) -- brackets, we can also write: -- --
--   data X = X
--       deriving Eq
--   
--   newDeclarationGroup
--   
--   $(do
--       info <- reify ''X
--       runIO $ print info
--    )
--   
newDeclarationGroup :: Q [Dec] -- | Obtained from reify in the Q Monad. data Info -- | A class, with a list of its visible instances ClassI :: Dec -> [InstanceDec] -> Info -- | A class method ClassOpI :: Name -> Type -> ParentName -> Info -- | A "plain" type constructor. "Fancier" type constructors are returned -- using PrimTyConI or FamilyI as appropriate. At present, -- this reified declaration will never have derived instances attached to -- it (if you wish to check for an instance, see reifyInstances). TyConI :: Dec -> Info -- | A type or data family, with a list of its visible instances. A closed -- type family is returned with 0 instances. FamilyI :: Dec -> [InstanceDec] -> Info -- | A "primitive" type constructor, which can't be expressed with a -- Dec. Examples: (->), Int#. PrimTyConI :: Name -> Arity -> Unlifted -> Info -- | A data constructor DataConI :: Name -> Type -> ParentName -> Info -- | A pattern synonym PatSynI :: Name -> PatSynType -> Info -- | A "value" variable (as opposed to a type variable, see TyVarI). -- -- The Maybe Dec field contains Just the declaration -- which defined the variable - including the RHS of the declaration - or -- else Nothing, in the case where the RHS is unavailable to the -- compiler. At present, this value is always Nothing: -- returning the RHS has not yet been implemented because of lack of -- interest. VarI :: Name -> Type -> Maybe Dec -> Info -- | A type variable. -- -- The Type field contains the type which underlies the -- variable. At present, this is always VarT theName, but -- future changes may permit refinement of this. TyVarI :: Name -> Type -> Info -- | Obtained from reifyModule in the Q Monad. data ModuleInfo -- | Contains the import list of the module. ModuleInfo :: [Module] -> ModuleInfo -- | InstanceDec describes a single instance of a class or type -- function. It is just a Dec, but guaranteed to be one of the -- following: -- -- type InstanceDec = Dec -- | In ClassOpI and DataConI, name of the parent class or -- type type ParentName = Name -- | In UnboxedSumE and UnboxedSumP, the number associated -- with a particular data constructor. SumAlts are one-indexed and -- should never exceed the value of its corresponding SumArity. -- For example: -- -- type SumAlt = Int -- | In UnboxedSumE, UnboxedSumT, and UnboxedSumP, the -- total number of SumAlts. For example, (#|#) has a -- SumArity of 2. type SumArity = Int -- | In PrimTyConI, arity of the type constructor type Arity = Int -- | List all enabled language extensions. extsEnabled :: Q [Extension] -- | Determine whether the given language extension is enabled in the -- Q monad. isExtEnabled :: Extension -> Q Bool -- | Look up the given name in the (type namespace of the) current splice's -- scope. See Language.Haskell.TH.Syntax#namelookup for more -- details. lookupTypeName :: String -> Q (Maybe Name) -- | Look up the given name in the (value namespace of the) current -- splice's scope. See Language.Haskell.TH.Syntax#namelookup for -- more details. lookupValueName :: String -> Q (Maybe Name) -- | reifyFixity nm attempts to find a fixity declaration for -- nm. For example, if the function foo has the fixity -- declaration infixr 7 foo, then reifyFixity 'foo -- would return Just (Fixity 7 InfixR). If -- the function bar does not have a fixity declaration, then -- reifyFixity 'bar returns Nothing, so you may assume -- bar has defaultFixity. reifyFixity :: Name -> Q (Maybe Fixity) -- | reifyType nm attempts to find the type or kind of -- nm. For example, reifyType 'not returns Bool -- -> Bool, and reifyType ''Bool returns Type. -- This works even if there's no explicit signature and the type or kind -- is inferred. reifyType :: Name -> Q Type -- | reifyInstances nm tys returns a list of all visible instances -- (see below for "visible") of nm tys. That is, if nm -- is the name of a type class, then all instances of this class at the -- types tys are returned. Alternatively, if nm is the -- name of a data family or type family, all instances of this family at -- the types tys are returned. -- -- Note that this is a "shallow" test; the declarations returned merely -- have instance heads which unify with nm tys, they need not -- actually be satisfiable. -- -- -- -- There is one edge case: reifyInstances ''Typeable tys -- currently always produces an empty list (no matter what tys -- are given). -- -- In principle, the *visible* instances are * all instances defined in a -- prior top-level declaration group (see docs on -- newDeclarationGroup), or * all instances defined in any -- module transitively imported by the module being compiled -- -- However, actually searching all modules transitively below the one -- being compiled is unreasonably expensive, so reifyInstances -- will report only the instance for modules that GHC has had some cause -- to visit during this compilation. This is a shortcoming: -- reifyInstances might fail to report instances for a type that -- is otherwise unusued, or instances defined in a different component. -- You can work around this shortcoming by explicitly importing the -- modules whose instances you want to be visible. GHC issue -- #20529 has some discussion around this. reifyInstances :: Name -> [Type] -> Q [InstanceDec] -- | Is the list of instances returned by reifyInstances nonempty? -- -- If you're confused by an instance not being visible despite being -- defined in the same module and above the splice in question, see the -- docs for newDeclarationGroup for a possible explanation. isInstance :: Name -> [Type] -> Q Bool -- | reifyRoles nm returns the list of roles associated with the -- parameters (both visible and invisible) of the tycon nm. -- Fails if nm cannot be found or is not a tycon. The returned -- list should never contain InferR. -- -- An invisible parameter to a tycon is often a kind parameter. For -- example, if we have -- --
--   type Proxy :: forall k. k -> Type
--   data Proxy a = MkProxy
--   
-- -- and reifyRoles Proxy, we will get [NominalR, -- PhantomR]. The NominalR is the role of the -- invisible k parameter. Kind parameters are always nominal. reifyRoles :: Name -> Q [Role] -- | reifyAnnotations target returns the list of annotations -- associated with target. Only the annotations that are -- appropriately typed is returned. So if you have Int and -- String annotations for the same target, you have to call this -- function twice. reifyAnnotations :: Data a => AnnLookup -> Q [a] -- | Annotation target for reifyAnnotations data AnnLookup AnnLookupModule :: Module -> AnnLookup AnnLookupName :: Name -> AnnLookup -- | reifyConStrictness nm looks up the strictness information for -- the fields of the constructor with the name nm. Note that the -- strictness information that reifyConStrictness returns may not -- correspond to what is written in the source code. For example, in the -- following data declaration: -- --
--   data Pair a = Pair a a
--   
-- -- reifyConStrictness would return [DecidedLazy, -- DecidedLazy] under most circumstances, but it would return -- [DecidedStrict, DecidedStrict] if the -- -XStrictData language extension was enabled. reifyConStrictness :: Name -> Q [DecidedStrictness] -- | Typed wrapper around an Exp. -- -- This is the typed representation of terms produced by typed quotes. -- -- Representation-polymorphic since template-haskell-2.16.0.0. newtype TExp (a :: TYPE r) TExp :: Exp -> TExp (a :: TYPE r) -- | Underlying untyped Template Haskell expression [unType] :: TExp (a :: TYPE r) -> Exp -- | Represents an expression which has type a, built in monadic -- context m. Built on top of TExp, typed expressions -- allow for type-safe splicing via: -- -- -- -- Traditional expression quotes and splices let us construct ill-typed -- expressions: -- --
--   >>> fmap ppr $ runQ (unTypeCode [| True == $( [| "foo" |] ) |])
--   GHC.Types.True GHC.Classes.== "foo"
--   
--   >>> GHC.Types.True GHC.Classes.== "foo"
--   <interactive> error:
--       • Couldn't match expected type ‘Bool’ with actual type ‘[Char]’
--       • In the second argument of ‘(==)’, namely ‘"foo"’
--         In the expression: True == "foo"
--         In an equation for ‘it’: it = True == "foo"
--   
-- -- With typed expressions, the type error occurs when constructing -- the Template Haskell expression: -- --
--   >>> fmap ppr $ runQ (unTypeCode [|| True == $$( [|| "foo" ||] ) ||])
--   <interactive> error:
--       • Couldn't match type ‘[Char]’ with ‘Bool’
--         Expected type: Code Q Bool
--           Actual type: Code Q [Char]
--       • In the Template Haskell quotation [|| "foo" ||]
--         In the expression: [|| "foo" ||]
--         In the Template Haskell splice $$([|| "foo" ||])
--   
newtype Code (m :: Type -> Type) (a :: TYPE r) Code :: m (TExp a) -> Code (m :: Type -> Type) (a :: TYPE r) -- | Underlying monadic value [examineCode] :: Code (m :: Type -> Type) (a :: TYPE r) -> m (TExp a) -- | Extract the untyped representation from the typed representation unTypeCode :: forall a m. Quote m => Code m a -> m Exp -- | Unsafely convert an untyped code representation into a typed code -- representation. unsafeCodeCoerce :: forall a m. Quote m => m Exp -> Code m a -- | Modify the ambient monad used during code generation. For example, you -- can use hoistCode to handle a state effect: handleState :: -- Code (StateT Int Q) a -> Code Q a handleState = hoistCode (flip -- runState 0) hoistCode :: Monad m => (forall x. () => m x -> n x) -> Code m a -> Code n a -- | Variant of (>>=) which allows effectful computations to be -- injected into code generation. bindCode :: Monad m => m a -> (a -> Code m b) -> Code m b -- | Variant of (>>) which allows effectful computations to be -- injected into code generation. bindCode_ :: Monad m => m a -> Code m b -> Code m b -- | A useful combinator for embedding monadic actions into Code -- myCode :: ... => Code m a myCode = joinCode $ do x <- -- someSideEffect return (makeCodeWith x) joinCode :: Monad m => m (Code m a) -> Code m a -- | Lift a monadic action producing code into the typed Code -- representation liftCode :: forall a m. m (TExp a) -> Code m a -- | An abstract type representing names in the syntax tree. -- -- Names can be constructed in several ways, which come with -- different name-capture guarantees (see -- Language.Haskell.TH.Syntax#namecapture for an explanation of -- name capture): -- -- -- -- Names constructed using newName and mkName may be -- used in bindings (such as let x = ... or x -> -- ...), but names constructed using lookupValueName, -- lookupTypeName, 'f, ''T may not. data Name Name :: OccName -> NameFlavour -> Name data NameSpace -- | Variables VarName :: NameSpace -- | Data constructors DataName :: NameSpace -- | Type constructors and classes; Haskell has them in the same name space -- for now. TcClsName :: NameSpace FldName :: !String -> NameSpace -- | The textual name of the parent of the field. -- -- [fldParent] :: NameSpace -> !String -- | Generate a capturable name. Occurrences of such names will be resolved -- according to the Haskell scoping rules at the occurrence site. -- -- For example: -- --
--   f = [| pi + $(varE (mkName "pi")) |]
--   ...
--   g = let pi = 3 in $f
--   
-- -- In this case, g is desugared to -- --
--   g = Prelude.pi + 3
--   
-- -- Note that mkName may be used with qualified names: -- --
--   mkName "Prelude.pi"
--   
-- -- See also dyn for a useful combinator. The above example could -- be rewritten using dyn as -- --
--   f = [| pi + $(dyn "pi") |]
--   
mkName :: String -> Name -- | The name without its module prefix. -- --

Examples

-- --
--   >>> nameBase ''Data.Either.Either
--   "Either"
--   
--   >>> nameBase (mkName "foo")
--   "foo"
--   
--   >>> nameBase (mkName "Module.foo")
--   "foo"
--   
nameBase :: Name -> String -- | Module prefix of a name, if it exists. -- --

Examples

-- --
--   >>> nameModule ''Data.Either.Either
--   Just "Data.Either"
--   
--   >>> nameModule (mkName "foo")
--   Nothing
--   
--   >>> nameModule (mkName "Module.foo")
--   Just "Module"
--   
nameModule :: Name -> Maybe String -- | A name's package, if it exists. -- --

Examples

-- --
--   >>> namePackage ''Data.Either.Either
--   Just "base"
--   
--   >>> namePackage (mkName "foo")
--   Nothing
--   
--   >>> namePackage (mkName "Module.foo")
--   Nothing
--   
namePackage :: Name -> Maybe String -- | Returns whether a name represents an occurrence of a top-level -- variable (VarName), data constructor (DataName), type -- constructor, or type class (TcClsName). If we can't be sure, it -- returns Nothing. -- --

Examples

-- --
--   >>> nameSpace 'Prelude.id
--   Just VarName
--   
--   >>> nameSpace (mkName "id")
--   Nothing -- only works for top-level variable names
--   
--   >>> nameSpace 'Data.Maybe.Just
--   Just DataName
--   
--   >>> nameSpace ''Data.Maybe.Maybe
--   Just TcClsName
--   
--   >>> nameSpace ''Data.Ord.Ord
--   Just TcClsName
--   
nameSpace :: Name -> Maybe NameSpace -- | Tuple type constructor tupleTypeName :: Int -> Name -- | Tuple data constructor tupleDataName :: Int -> Name -- | Unboxed tuple type constructor unboxedTupleTypeName :: Int -> Name -- | Unboxed tuple data constructor unboxedTupleDataName :: Int -> Name -- | Unboxed sum type constructor unboxedSumTypeName :: SumArity -> Name -- | Unboxed sum data constructor unboxedSumDataName :: SumAlt -> SumArity -> Name data Dec -- |
--   { f p1 p2 = b where decs }
--   
FunD :: Name -> [Clause] -> Dec -- |
--   { p = b where decs }
--   
ValD :: Pat -> Body -> [Dec] -> Dec -- |
--   { data Cxt x => T x = A x | B (T x)
--          deriving (Z,W)
--          deriving stock Eq }
--   
DataD :: Cxt -> Name -> [TyVarBndr BndrVis] -> Maybe Kind -> [Con] -> [DerivClause] -> Dec -- |
--   { newtype Cxt x => T x = A (B x)
--          deriving (Z,W Q)
--          deriving stock Eq }
--   
NewtypeD :: Cxt -> Name -> [TyVarBndr BndrVis] -> Maybe Kind -> Con -> [DerivClause] -> Dec -- |
--   { type data T x = A x | B (T x) }
--   
TypeDataD :: Name -> [TyVarBndr BndrVis] -> Maybe Kind -> [Con] -> Dec -- |
--   { type T x = (x,x) }
--   
TySynD :: Name -> [TyVarBndr BndrVis] -> Type -> Dec -- |
--   { class Eq a => Ord a where ds }
--   
ClassD :: Cxt -> Name -> [TyVarBndr BndrVis] -> [FunDep] -> [Dec] -> Dec -- |
--   { instance {-# OVERLAPS #-}
--           Show w => Show [w] where ds }
--   
InstanceD :: Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec -- |
--   { length :: [a] -> Int }
--   
SigD :: Name -> Type -> Dec -- |
--   { type TypeRep :: k -> Type }
--   
KiSigD :: Name -> Kind -> Dec -- |
--   { foreign import ... }
--   { foreign export ... }
--   
ForeignD :: Foreign -> Dec -- |
--   { infix 3 data foo }
--   
InfixD :: Fixity -> NamespaceSpecifier -> Name -> Dec -- |
--   { default (Integer, Double) }
--   
DefaultD :: [Type] -> Dec -- | pragmas PragmaD :: Pragma -> Dec -- | data families (may also appear in [Dec] of ClassD and -- InstanceD) DataFamilyD :: Name -> [TyVarBndr BndrVis] -> Maybe Kind -> Dec -- |
--   { data instance Cxt x => T [x]
--          = A x | B (T x)
--          deriving (Z,W)
--          deriving stock Eq }
--   
DataInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> [Con] -> [DerivClause] -> Dec -- |
--   { newtype instance Cxt x => T [x]
--           = A (B x)
--           deriving (Z,W)
--           deriving stock Eq }
--   
NewtypeInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> Con -> [DerivClause] -> Dec -- |
--   { type instance ... }
--   
TySynInstD :: TySynEqn -> Dec -- | open type families (may also appear in [Dec] of ClassD and -- InstanceD) OpenTypeFamilyD :: TypeFamilyHead -> Dec -- |
--   { type family F a b = (r :: *) | r -> a where ... }
--   
ClosedTypeFamilyD :: TypeFamilyHead -> [TySynEqn] -> Dec -- |
--   { type role T nominal representational }
--   
RoleAnnotD :: Name -> [Role] -> Dec -- |
--   { deriving stock instance Ord a => Ord (Foo a) }
--   
StandaloneDerivD :: Maybe DerivStrategy -> Cxt -> Type -> Dec -- |
--   { default size :: Data a => a -> Int }
--   
DefaultSigD :: Name -> Type -> Dec -- | Pattern Synonyms PatSynD :: Name -> PatSynArgs -> PatSynDir -> Pat -> Dec -- | A pattern synonym's type signature. PatSynSigD :: Name -> PatSynType -> Dec -- |
--   { ?x = expr }
--   
-- -- Implicit parameter binding declaration. Can only be used in let and -- where clauses which consist entirely of implicit bindings. ImplicitParamBindD :: String -> Exp -> Dec data Clause -- |
--   f { p1 p2 = body where decs }
--   
Clause :: [Pat] -> Body -> [Dec] -> Clause data Bang -- |
--   C { {-# UNPACK #-} !}a
--   
Bang :: SourceUnpackedness -> SourceStrictness -> Bang data Callconv CCall :: Callconv StdCall :: Callconv CApi :: Callconv Prim :: Callconv JavaScript :: Callconv data Pragma InlineP :: Name -> Inline -> RuleMatch -> Phases -> Pragma OpaqueP :: Name -> Pragma SpecialiseP :: Name -> Type -> Maybe Inline -> Phases -> Pragma SpecialiseInstP :: Type -> Pragma RuleP :: String -> Maybe [TyVarBndr ()] -> [RuleBndr] -> Exp -> Exp -> Phases -> Pragma AnnP :: AnnTarget -> Exp -> Pragma LineP :: Int -> String -> Pragma -- |
--   { {-# COMPLETE C_1, ..., C_i [ :: T ] #-} }
--   
CompleteP :: [Name] -> Maybe Name -> Pragma -- |
--   { {-# SCC fun "optional_name" #-} }
--   
SCCP :: Name -> Maybe String -> Pragma data Inline NoInline :: Inline Inline :: Inline Inlinable :: Inline data RuleMatch ConLike :: RuleMatch FunLike :: RuleMatch data Phases AllPhases :: Phases FromPhase :: Int -> Phases BeforePhase :: Int -> Phases data RuleBndr RuleVar :: Name -> RuleBndr TypedRuleVar :: Name -> Type -> RuleBndr data AnnTarget ModuleAnnotation :: AnnTarget TypeAnnotation :: Name -> AnnTarget ValueAnnotation :: Name -> AnnTarget data FunDep FunDep :: [Name] -> [Name] -> FunDep -- | One equation of a type family instance or closed type family. The -- arguments are the left-hand-side type and the right-hand-side result. -- -- For instance, if you had the following type family: -- --
--   type family Foo (a :: k) :: k where
--     forall k (a :: k). Foo @k a = a
--   
-- -- The Foo @k a = a equation would be represented as follows: -- --
--   TySynEqn (Just [PlainTV k, KindedTV a (VarT k)])
--              (AppT (AppKindT (ConT ''Foo) (VarT k)) (VarT a))
--              (VarT a)
--   
data TySynEqn TySynEqn :: Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn -- | Common elements of OpenTypeFamilyD and -- ClosedTypeFamilyD. By analogy with "head" for type classes and -- type class instances as defined in Type classes: an exploration of -- the design space, the TypeFamilyHead is defined to be the -- elements of the declaration between type family and -- where. data TypeFamilyHead TypeFamilyHead :: Name -> [TyVarBndr BndrVis] -> FamilyResultSig -> Maybe InjectivityAnn -> TypeFamilyHead data FixityDirection InfixL :: FixityDirection InfixR :: FixityDirection InfixN :: FixityDirection -- | A way to specify a namespace to look in when GHC needs to find a -- name's source data NamespaceSpecifier -- | Name may be everything; If there are two names in different -- namespaces, then consider both NoNamespaceSpecifier :: NamespaceSpecifier -- | Name should be a type-level entity, such as a data type, type alias, -- type family, type class, or type variable TypeNamespaceSpecifier :: NamespaceSpecifier -- | Name should be a term-level entity, such as a function, data -- constructor, or pattern synonym DataNamespaceSpecifier :: NamespaceSpecifier -- | Default fixity: infixl 9 defaultFixity :: Fixity -- | Highest allowed operator precedence for Fixity constructor -- (answer: 9) maxPrecedence :: Int -- | A pattern synonym's directionality. data PatSynDir -- |
--   pattern P x {<-} p
--   
Unidir :: PatSynDir -- |
--   pattern P x {=} p
--   
ImplBidir :: PatSynDir -- |
--   pattern P x {<-} p where P x = e
--   
ExplBidir :: [Clause] -> PatSynDir -- | A pattern synonym's argument type. data PatSynArgs -- |
--   pattern P {x y z} = p
--   
PrefixPatSyn :: [Name] -> PatSynArgs -- |
--   pattern {x P y} = p
--   
InfixPatSyn :: Name -> Name -> PatSynArgs -- |
--   pattern P { {x,y,z} } = p
--   
RecordPatSyn :: [Name] -> PatSynArgs data Exp -- |
--   { x }
--   
VarE :: Name -> Exp -- |
--   data T1 = C1 t1 t2; p = {C1} e1 e2
--   
ConE :: Name -> Exp -- |
--   { 5 or 'c'}
--   
LitE :: Lit -> Exp -- |
--   { f x }
--   
AppE :: Exp -> Exp -> Exp -- |
--   { f @Int }
--   
AppTypeE :: Exp -> Type -> Exp -- |
--   {x + y} or {(x+)} or {(+ x)} or {(+)}
--   
InfixE :: Maybe Exp -> Exp -> Maybe Exp -> Exp -- |
--   {x + y}
--   
-- -- See Language.Haskell.TH.Syntax#infix UInfixE :: Exp -> Exp -> Exp -> Exp -- |
--   { (e) }
--   
-- -- See Language.Haskell.TH.Syntax#infix ParensE :: Exp -> Exp -- |
--   { \ p1 p2 -> e }
--   
LamE :: [Pat] -> Exp -> Exp -- |
--   { \case m1; m2 }
--   
LamCaseE :: [Match] -> Exp -- |
--   { \cases m1; m2 }
--   
LamCasesE :: [Clause] -> Exp -- |
--   { (e1,e2) }
--   
-- -- The Maybe is necessary for handling tuple sections. -- --
--   (1,)
--   
-- -- translates to -- --
--   TupE [Just (LitE (IntegerL 1)),Nothing]
--   
TupE :: [Maybe Exp] -> Exp -- |
--   { (# e1,e2 #) }
--   
-- -- The Maybe is necessary for handling tuple sections. -- --
--   (# 'c', #)
--   
-- -- translates to -- --
--   UnboxedTupE [Just (LitE (CharL 'c')),Nothing]
--   
UnboxedTupE :: [Maybe Exp] -> Exp -- |
--   { (#|e|#) }
--   
UnboxedSumE :: Exp -> SumAlt -> SumArity -> Exp -- |
--   { if e1 then e2 else e3 }
--   
CondE :: Exp -> Exp -> Exp -> Exp -- |
--   { if | g1 -> e1 | g2 -> e2 }
--   
MultiIfE :: [(Guard, Exp)] -> Exp -- |
--   { let { x=e1; y=e2 } in e3 }
--   
LetE :: [Dec] -> Exp -> Exp -- |
--   { case e of m1; m2 }
--   
CaseE :: Exp -> [Match] -> Exp -- | { do { p <- e1; e2 } } or a qualified do if the module -- name is present DoE :: Maybe ModName -> [Stmt] -> Exp -- | { mdo { x <- e1 y; y <- e2 x; } } or a qualified mdo if -- the module name is present MDoE :: Maybe ModName -> [Stmt] -> Exp -- |
--   { [ (x,y) | x <- xs, y <- ys ] }
--   
-- -- The result expression of the comprehension is the last of the -- Stmts, and should be a NoBindS. -- -- E.g. translation: -- --
--   [ f x | x <- xs ]
--   
-- --
--   CompE [BindS (VarP x) (VarE xs), NoBindS (AppE (VarE f) (VarE x))]
--   
CompE :: [Stmt] -> Exp -- |
--   { [ 1 ,2 .. 10 ] }
--   
ArithSeqE :: Range -> Exp -- |
--   { [1,2,3] }
--   
ListE :: [Exp] -> Exp -- |
--   { e :: t }
--   
SigE :: Exp -> Type -> Exp -- |
--   { T { x = y, z = w } }
--   
RecConE :: Name -> [FieldExp] -> Exp -- |
--   { (f x) { z = w } }
--   
RecUpdE :: Exp -> [FieldExp] -> Exp -- |
--   { static e }
--   
StaticE :: Exp -> Exp -- |
--   { _x }
--   
-- -- This is used for holes or unresolved identifiers in AST quotes. Note -- that it could either have a variable name or constructor name. UnboundVarE :: Name -> Exp -- | { #x } ( Overloaded label ) LabelE :: String -> Exp -- | { ?x } ( Implicit parameter ) ImplicitParamVarE :: String -> Exp -- | { exp.field } ( Overloaded Record Dot ) GetFieldE :: Exp -> String -> Exp -- | (.x) or (.x.y) (Record projections) ProjectionE :: NonEmpty String -> Exp -- |
--   [|| e ||]
--   
TypedBracketE :: Exp -> Exp -- |
--   $$e
--   
TypedSpliceE :: Exp -> Exp -- |
--   { type t }
--   
TypeE :: Type -> Exp data Match -- |
--   case e of { pat -> body where decs }
--   
Match :: Pat -> Body -> [Dec] -> Match data Body -- |
--   f p { | e1 = e2
--         | e3 = e4 }
--    where ds
--   
GuardedB :: [(Guard, Exp)] -> Body -- |
--   f p { = e } where ds
--   
NormalB :: Exp -> Body data Guard -- |
--   f x { | odd x } = x
--   
NormalG :: Exp -> Guard -- |
--   f x { | Just y <- x, Just z <- y } = z
--   
PatG :: [Stmt] -> Guard data Stmt -- |
--   p <- e
--   
BindS :: Pat -> Exp -> Stmt -- |
--   { let { x=e1; y=e2 } }
--   
LetS :: [Dec] -> Stmt -- |
--   e
--   
NoBindS :: Exp -> Stmt -- | x <- e1 | s2, s3 | s4 (in CompE) ParS :: [[Stmt]] -> Stmt -- |
--   rec { s1; s2 }
--   
RecS :: [Stmt] -> Stmt data Range FromR :: Exp -> Range FromThenR :: Exp -> Exp -> Range FromToR :: Exp -> Exp -> Range FromThenToR :: Exp -> Exp -> Exp -> Range data Lit CharL :: Char -> Lit StringL :: String -> Lit -- | Used for overloaded and non-overloaded literals. We don't have a good -- way to represent non-overloaded literals at the moment. Maybe that -- doesn't matter? IntegerL :: Integer -> Lit RationalL :: Rational -> Lit IntPrimL :: Integer -> Lit WordPrimL :: Integer -> Lit FloatPrimL :: Rational -> Lit DoublePrimL :: Rational -> Lit -- | A primitive C-style string, type Addr# StringPrimL :: [Word8] -> Lit -- | Some raw bytes, type Addr#: BytesPrimL :: Bytes -> Lit CharPrimL :: Char -> Lit -- | Pattern in Haskell given in {} data Pat -- |
--   { 5 or 'c' }
--   
LitP :: Lit -> Pat -- |
--   { x }
--   
VarP :: Name -> Pat -- |
--   { (p1,p2) }
--   
TupP :: [Pat] -> Pat -- |
--   { (# p1,p2 #) }
--   
UnboxedTupP :: [Pat] -> Pat -- |
--   { (#|p|#) }
--   
UnboxedSumP :: Pat -> SumAlt -> SumArity -> Pat -- |
--   data T1 = C1 t1 t2; {C1 @ty1 p1 p2} = e
--   
ConP :: Name -> [Type] -> [Pat] -> Pat -- |
--   foo ({x :+ y}) = e
--   
InfixP :: Pat -> Name -> Pat -> Pat -- |
--   foo ({x :+ y}) = e
--   
-- -- See Language.Haskell.TH.Syntax#infix UInfixP :: Pat -> Name -> Pat -> Pat -- |
--   {(p)}
--   
-- -- See Language.Haskell.TH.Syntax#infix ParensP :: Pat -> Pat -- |
--   { ~p }
--   
TildeP :: Pat -> Pat -- |
--   { !p }
--   
BangP :: Pat -> Pat -- |
--   { x @ p }
--   
AsP :: Name -> Pat -> Pat -- |
--   { _ }
--   
WildP :: Pat -- |
--   f (Pt { pointx = x }) = g x
--   
RecP :: Name -> [FieldPat] -> Pat -- |
--   { [1,2,3] }
--   
ListP :: [Pat] -> Pat -- |
--   { p :: t }
--   
SigP :: Pat -> Type -> Pat -- |
--   { e -> p }
--   
ViewP :: Exp -> Pat -> Pat -- |
--   { type p }
--   
TypeP :: Type -> Pat -- | { p }@ InvisP :: Type -> Pat type FieldExp = (Name, Exp) type FieldPat = (Name, Pat) -- | The flag type parameter is instantiated to one of the -- following types: -- -- data TyVarBndr flag -- |
--   a
--   
PlainTV :: Name -> flag -> TyVarBndr flag -- |
--   (a :: k)
--   
KindedTV :: Name -> flag -> Kind -> TyVarBndr flag data TyLit -- |
--   2
--   
NumTyLit :: Integer -> TyLit -- |
--   "Hello"
--   
StrTyLit :: String -> TyLit -- | 'C', @since 4.16.0.0 CharTyLit :: Char -> TyLit -- | To avoid duplication between kinds and types, they are defined to be -- the same. Naturally, you would never have a type be StarT and -- you would never have a kind be SigT, but many of the other -- constructors are shared. Note that the kind Bool is denoted -- with ConT, not PromotedT. Similarly, tuple kinds are -- made with TupleT, not PromotedTupleT. type Kind = Type type Cxt = [Pred] -- | Since the advent of ConstraintKinds, constraints are really -- just types. Equality constraints use the EqualityT constructor. -- Constraints may also be tuples of other constraints. type Pred = Type -- | Role annotations data Role -- |
--   nominal
--   
NominalR :: Role -- |
--   representational
--   
RepresentationalR :: Role -- |
--   phantom
--   
PhantomR :: Role -- |
--   _
--   
InferR :: Role data Specificity -- |
--   a
--   
SpecifiedSpec :: Specificity -- |
--   {a}
--   
InferredSpec :: Specificity data BndrVis -- |
--   a
--   
BndrReq :: BndrVis -- |
--   @a
--   
BndrInvis :: BndrVis -- | Type family result signature data FamilyResultSig -- | no signature NoSig :: FamilyResultSig -- |
--   k
--   
KindSig :: Kind -> FamilyResultSig -- |
--   = r, = (r :: k)
--   
TyVarSig :: TyVarBndr () -> FamilyResultSig -- | Injectivity annotation data InjectivityAnn InjectivityAnn :: Name -> [Name] -> InjectivityAnn -- | A pattern synonym's type. Note that a pattern synonym's fully -- specified type has a peculiar shape coming with two forall quantifiers -- and two constraint contexts. For example, consider the pattern synonym -- --
--   pattern P x1 x2 ... xn = <some-pattern>
--   
-- -- P's complete type is of the following form -- --
--   pattern P :: forall universals.   required constraints
--             => forall existentials. provided constraints
--             => t1 -> t2 -> ... -> tn -> t
--   
-- -- consisting of four parts: -- --
    --
  1. the (possibly empty lists of) universally quantified type -- variables and required constraints on them.
  2. --
  3. the (possibly empty lists of) existentially quantified type -- variables and the provided constraints on them.
  4. --
  5. the types t1, t2, .., tn of -- x1, x2, .., xn, respectively
  6. --
  7. the type t of <some-pattern>, mentioning -- only universals.
  8. --
-- -- Pattern synonym types interact with TH when (a) reifying a pattern -- synonym, (b) pretty printing, or (c) specifying a pattern synonym's -- type signature explicitly: -- -- -- -- See the GHC user's guide for more information on pattern synonyms and -- their types: -- https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#pattern-synonyms. type PatSynType = Type type BangType = (Bang, Type) type VarBangType = (Name, Bang, Type) -- | Add Haddock documentation to the specified location. This will -- overwrite any documentation at the location if it already exists. This -- will reify the specified name, so it must be in scope when you call -- it. If you want to add documentation to something that you are -- currently splicing, you can use addModFinalizer e.g. -- --
--   do
--     let nm = mkName "x"
--     addModFinalizer $ putDoc (DeclDoc nm) "Hello"
--     [d| $(varP nm) = 42 |]
--   
-- -- The helper functions withDecDoc and withDecsDoc will -- do this for you, as will the funD_doc and other _doc -- combinators. You most likely want to have the -haddock flag -- turned on when using this. Adding documentation to anything outside of -- the current module will cause an error. putDoc :: DocLoc -> String -> Q () -- | Retrieves the Haddock documentation at the specified location, if one -- exists. It can be used to read documentation on things defined outside -- of the current module, provided that those modules were compiled with -- the -haddock flag. getDoc :: DocLoc -> Q (Maybe String) -- | A location at which to attach Haddock documentation. Note that adding -- documentation to a Name defined oustide of the current module -- will cause an error. data DocLoc -- | At the current module's header. ModuleDoc :: DocLoc -- | At a declaration, not necessarily top level. DeclDoc :: Name -> DocLoc -- | At a specific argument of a function, indexed by its position. ArgDoc :: Name -> Int -> DocLoc -- | At a class or family instance. InstDoc :: Type -> DocLoc -- | A single deriving clause at the end of a datatype. data DerivClause -- |
--   { deriving stock (Eq, Ord) }
--   
DerivClause :: Maybe DerivStrategy -> Cxt -> DerivClause -- | What the user explicitly requests when deriving an instance. data DerivStrategy -- | A "standard" derived instance StockStrategy :: DerivStrategy -- |
--   -XDeriveAnyClass
--   
AnyclassStrategy :: DerivStrategy -- |
--   -XGeneralizedNewtypeDeriving
--   
NewtypeStrategy :: DerivStrategy -- |
--   -XDerivingVia
--   
ViaStrategy :: Type -> DerivStrategy -- | Varieties of allowed instance overlap. data Overlap -- | May be overlapped by more specific instances Overlappable :: Overlap -- | May overlap a more general instance Overlapping :: Overlap -- | Both Overlapping and Overlappable Overlaps :: Overlap -- | Both Overlapping and Overlappable, and pick an arbitrary -- one if multiple choices are available. Incoherent :: Overlap -- | Uniq is used by GHC to distinguish names from each other. type Uniq = Integer showName' :: NameIs -> Name -> String data NameFlavour -- | An unqualified name; dynamically bound NameS :: NameFlavour -- | A qualified name; dynamically bound NameQ :: ModName -> NameFlavour -- | A unique local name NameU :: !Uniq -> NameFlavour -- | Local name bound outside of the TH AST NameL :: !Uniq -> NameFlavour -- | Global name bound outside of the TH AST: An original name (occurrences -- only, not binders) Need the namespace too to be sure which thing we -- are naming NameG :: NameSpace -> PkgName -> ModName -> NameFlavour -- | dataToQa is an internal utility function for constructing -- generic conversion functions from types with Data instances to -- various quasi-quoting representations. See the source of -- dataToExpQ and dataToPatQ for two example usages: -- mkCon, mkLit and appQ are overloadable to -- account for different syntax for expressions and patterns; -- antiQ allows you to override type-specific cases, a common -- usage is just const Nothing, which results in no overloading. dataToQa :: (Quote m, Data a) => (Name -> k) -> (Lit -> m q) -> (k -> [m q] -> m q) -> (forall b. Data b => b -> Maybe (m q)) -> a -> m q -- | dataToExpQ converts a value to a Exp representation of -- the same value, in the SYB style. It is generalized to take a function -- override type-specific cases; see liftData for a more commonly -- used variant. dataToExpQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Exp)) -> a -> m Exp -- | dataToPatQ converts a value to a Pat representation of -- the same value, in the SYB style. It takes a function to handle -- type-specific cases, alternatively, pass const Nothing to get -- default behavior. dataToPatQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Pat)) -> a -> m Pat -- | Raw bytes embedded into the binary. -- -- Avoid using Bytes constructor directly as it is likely to change in -- the future. Use helpers such as mkBytes in -- Language.Haskell.TH.Lib instead. data Bytes Bytes :: ForeignPtr Word8 -> Word -> Word -> Bytes -- | Pointer to the data [bytesPtr] :: Bytes -> ForeignPtr Word8 -- | Offset from the pointer [bytesOffset] :: Bytes -> Word -- | Number of bytes [bytesSize] :: Bytes -> Word class (MonadIO m, MonadFail m) => Quasi (m :: Type -> Type) qNewName :: Quasi m => String -> m Name qReport :: Quasi m => Bool -> String -> m () qRecover :: Quasi m => m a -> m a -> m a qLookupName :: Quasi m => Bool -> String -> m (Maybe Name) qReify :: Quasi m => Name -> m Info qReifyFixity :: Quasi m => Name -> m (Maybe Fixity) qReifyType :: Quasi m => Name -> m Type qReifyInstances :: Quasi m => Name -> [Type] -> m [Dec] qReifyRoles :: Quasi m => Name -> m [Role] qReifyAnnotations :: (Quasi m, Data a) => AnnLookup -> m [a] qReifyModule :: Quasi m => Module -> m ModuleInfo qReifyConStrictness :: Quasi m => Name -> m [DecidedStrictness] qLocation :: Quasi m => m Loc qRunIO :: Quasi m => IO a -> m a qGetPackageRoot :: Quasi m => m FilePath qAddDependentFile :: Quasi m => FilePath -> m () qAddTempFile :: Quasi m => String -> m FilePath qAddTopDecls :: Quasi m => [Dec] -> m () qAddForeignFilePath :: Quasi m => ForeignSrcLang -> String -> m () qAddModFinalizer :: Quasi m => Q () -> m () qAddCorePlugin :: Quasi m => String -> m () qGetQ :: (Quasi m, Typeable a) => m (Maybe a) qPutQ :: (Quasi m, Typeable a) => a -> m () qIsExtEnabled :: Quasi m => Extension -> m Bool qExtsEnabled :: Quasi m => m [Extension] qPutDoc :: Quasi m => DocLoc -> String -> m () qGetDoc :: Quasi m => DocLoc -> m (Maybe String) newNameIO :: String -> IO Name badIO :: String -> IO a counter :: IORef Uniq -- | Only used internally mkNameU :: String -> Uniq -> Name -- | Discard the type annotation and produce a plain Template Haskell -- expression -- -- Representation-polymorphic since template-haskell-2.16.0.0. unTypeQ :: forall a m. Quote m => m (TExp a) -> m Exp -- | Annotate the Template Haskell expression with a type -- -- This is unsafe because GHC cannot check for you that the expression -- really does have the type you claim it has. -- -- Representation-polymorphic since template-haskell-2.16.0.0. unsafeTExpCoerce :: forall a m. Quote m => m Exp -> m (TExp a) lookupName :: Bool -> String -> Q (Maybe Name) -- | Get the package root for the current package which is being compiled. -- This can be set explicitly with the -package-root flag but is normally -- just the current working directory. -- -- The motivation for this flag is to provide a principled means to -- remove the assumption from splices that they will be executed in the -- directory where the cabal file resides. Projects such as -- haskell-language-server can't and don't change directory when -- compiling files but instead set the -package-root flag appropriately. getPackageRoot :: Q FilePath -- | The input is a filepath, which if relative is offset by the package -- root. makeRelativeToProject :: FilePath -> Q FilePath -- | Record external files that runIO is using (dependent upon). The -- compiler can then recognize that it should re-compile the Haskell file -- when an external file changes. -- -- Expects an absolute file path. -- -- Notes: -- -- addDependentFile :: FilePath -> Q () -- | Obtain a temporary file path with the given suffix. The compiler will -- delete this file after compilation. addTempFile :: String -> Q FilePath -- | Add additional top-level declarations. The added declarations will be -- type checked along with the current declaration group. addTopDecls :: [Dec] -> Q () -- | Deprecated: Use addForeignSource instead addForeignFile :: ForeignSrcLang -> String -> Q () -- | Emit a foreign file which will be compiled and linked to the object -- for the current module. Currently only languages that can be compiled -- with the C compiler are supported, and the flags passed as part of -- -optc will be also applied to the C compiler invocation that will -- compile them. -- -- Note that for non-C languages (for example C++) extern -- C directives must be used to get symbols that we can -- access from Haskell. -- -- To get better errors, it is recommended to use #line pragmas when -- emitting C files, e.g. -- --
--   {-# LANGUAGE CPP #-}
--   ...
--   addForeignSource LangC $ unlines
--     [ "#line " ++ show (844 + 1) ++ " " ++ show "libraries/template-haskell/Language/Haskell/TH/Syntax.hs"
--     , ...
--     ]
--   
addForeignSource :: ForeignSrcLang -> String -> Q () -- | Same as addForeignSource, but expects to receive a path -- pointing to the foreign file instead of a String of its -- contents. Consider using this in conjunction with addTempFile. -- -- This is a good alternative to addForeignSource when you are -- trying to directly link in an object file. addForeignFilePath :: ForeignSrcLang -> FilePath -> Q () -- | Add a finalizer that will run in the Q monad after the current module -- has been type checked. This only makes sense when run within a -- top-level splice. -- -- The finalizer is given the local type environment at the splice point. -- Thus reify is able to find the local definitions when executed -- inside the finalizer. addModFinalizer :: Q () -> Q () -- | Adds a core plugin to the compilation pipeline. -- -- addCorePlugin m has almost the same effect as passing -- -fplugin=m to ghc in the command line. The major difference -- is that the plugin module m must not belong to the current -- package. When TH executes, it is too late to tell the compiler that we -- needed to compile first a plugin module in the current package. addCorePlugin :: String -> Q () -- | Get state from the Q monad. Note that the state is local to the -- Haskell module in which the Template Haskell expression is executed. getQ :: Typeable a => Q (Maybe a) -- | Replace the state in the Q monad. Note that the state is local -- to the Haskell module in which the Template Haskell expression is -- executed. putQ :: Typeable a => a -> Q () sequenceQ :: Monad m => forall a. () => [m a] -> m [a] trueName :: Name falseName :: Name addrToByteArrayName :: Name addrToByteArray :: Int -> Addr# -> ByteArray nothingName :: Name justName :: Name leftName :: Name rightName :: Name liftString :: Quote m => String -> m Exp nonemptyName :: Name oneName :: Name manyName :: Name mkOccName :: String -> OccName mkPkgName :: String -> PkgName mkModName :: String -> ModName mkNameG_v :: String -> String -> String -> Name mkNameG_d :: String -> String -> String -> Name showName :: Name -> String -- | liftData is a variant of lift in the Lift type -- class which works for any type with a Data instance. liftData :: (Quote m, Data a) => a -> m Exp newtype ModName ModName :: String -> ModName newtype PkgName PkgName :: String -> PkgName newtype OccName OccName :: String -> OccName modString :: ModName -> String pkgString :: PkgName -> String occString :: OccName -> String thenCmp :: Ordering -> Ordering -> Ordering -- | Only used internally mkNameL :: String -> Uniq -> Name -- | Only used internally mkNameQ :: String -> String -> Name -- | Used for 'x etc, but not available to the programmer mkNameG :: NameSpace -> String -> String -> String -> Name mkNameS :: String -> Name mkNameG_tc :: String -> String -> String -> Name mkNameG_fld :: String -> String -> String -> String -> Name mk_tup_name :: Int -> NameSpace -> Bool -> Name type CharPos = (Int, Int) eqBytes :: Bytes -> Bytes -> Bool compareBytes :: Bytes -> Bytes -> Ordering memcmp :: Ptr a -> Ptr b -> CSize -> IO CInt -- | As of template-haskell-2.11.0.0, StrictType has been -- replaced by BangType. type StrictType = BangType -- | As of template-haskell-2.11.0.0, VarStrictType has -- been replaced by VarBangType. type VarStrictType = VarBangType cmpEq :: Ordering -> Bool get_cons_names :: Con -> [Name] -- | Foreign formats supported by GHC via TH data ForeignSrcLang -- | C LangC :: ForeignSrcLang -- | C++ LangCxx :: ForeignSrcLang -- | Objective C LangObjc :: ForeignSrcLang -- | Objective C++ LangObjcxx :: ForeignSrcLang -- | Assembly language (.s) LangAsm :: ForeignSrcLang -- | JavaScript LangJs :: ForeignSrcLang -- | Object (.o) RawObject :: ForeignSrcLang instance GHC.Internal.Base.Applicative Language.Haskell.TH.Syntax.Q instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.AnnLookup instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.AnnTarget instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Bang instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.BndrVis instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Body instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Bytes instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Callconv instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Clause instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Con instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Dec instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.DecidedStrictness instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.DerivClause instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.DerivStrategy instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.DocLoc instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Exp instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.FamilyResultSig instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Fixity instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.FixityDirection instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Foreign instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.FunDep instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Guard instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Info instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.InjectivityAnn instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Inline instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Lit instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Loc instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Match instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.ModName instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Module instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.ModuleInfo instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Name instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.NameFlavour instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.NameSpace instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.NamespaceSpecifier instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.OccName instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Overlap instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Pat instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.PatSynArgs instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.PatSynDir instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Phases instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.PkgName instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Pragma instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Range instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Role instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.RuleBndr instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.RuleMatch instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Safety instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.SourceStrictness instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.SourceUnpackedness instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Specificity instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Stmt instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.TyLit instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.TySynEqn instance GHC.Internal.Data.Data.Data flag => GHC.Internal.Data.Data.Data (Language.Haskell.TH.Syntax.TyVarBndr flag) instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.Type instance GHC.Internal.Data.Data.Data Language.Haskell.TH.Syntax.TypeFamilyHead instance GHC.Classes.Eq Language.Haskell.TH.Syntax.AnnLookup instance GHC.Classes.Eq Language.Haskell.TH.Syntax.AnnTarget instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Bang instance GHC.Classes.Eq Language.Haskell.TH.Syntax.BndrVis instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Body instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Bytes instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Callconv instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Clause instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Con instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Dec instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DecidedStrictness instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DerivClause instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DerivStrategy instance GHC.Classes.Eq Language.Haskell.TH.Syntax.DocLoc instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Exp instance GHC.Classes.Eq Language.Haskell.TH.Syntax.FamilyResultSig instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Fixity instance GHC.Classes.Eq Language.Haskell.TH.Syntax.FixityDirection instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Foreign instance GHC.Classes.Eq Language.Haskell.TH.Syntax.FunDep instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Guard instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Info instance GHC.Classes.Eq Language.Haskell.TH.Syntax.InjectivityAnn instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Inline instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Lit instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Loc instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Match instance GHC.Classes.Eq Language.Haskell.TH.Syntax.ModName instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Module instance GHC.Classes.Eq Language.Haskell.TH.Syntax.ModuleInfo instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Name instance GHC.Classes.Eq Language.Haskell.TH.Syntax.NameFlavour instance GHC.Classes.Eq Language.Haskell.TH.Syntax.NameSpace instance GHC.Classes.Eq Language.Haskell.TH.Syntax.NamespaceSpecifier instance GHC.Classes.Eq Language.Haskell.TH.Syntax.OccName instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Overlap instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Pat instance GHC.Classes.Eq Language.Haskell.TH.Syntax.PatSynArgs instance GHC.Classes.Eq Language.Haskell.TH.Syntax.PatSynDir instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Phases instance GHC.Classes.Eq Language.Haskell.TH.Syntax.PkgName instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Pragma instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Range instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Role instance GHC.Classes.Eq Language.Haskell.TH.Syntax.RuleBndr instance GHC.Classes.Eq Language.Haskell.TH.Syntax.RuleMatch instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Safety instance GHC.Classes.Eq Language.Haskell.TH.Syntax.SourceStrictness instance GHC.Classes.Eq Language.Haskell.TH.Syntax.SourceUnpackedness instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Specificity instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Stmt instance GHC.Classes.Eq Language.Haskell.TH.Syntax.TyLit instance GHC.Classes.Eq Language.Haskell.TH.Syntax.TySynEqn instance GHC.Classes.Eq flag => GHC.Classes.Eq (Language.Haskell.TH.Syntax.TyVarBndr flag) instance GHC.Classes.Eq Language.Haskell.TH.Syntax.Type instance GHC.Classes.Eq Language.Haskell.TH.Syntax.TypeFamilyHead instance GHC.Internal.Data.Foldable.Foldable Language.Haskell.TH.Syntax.TyVarBndr instance GHC.Internal.Base.Functor Language.Haskell.TH.Syntax.Q instance GHC.Internal.Base.Functor Language.Haskell.TH.Syntax.TyVarBndr instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.AnnLookup instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.AnnTarget instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Bang instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.BndrVis instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Body instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Bytes instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Callconv instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Clause instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Con instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Dec instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.DecidedStrictness instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.DerivClause instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.DerivStrategy instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.DocLoc instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Exp instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.FamilyResultSig instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Fixity instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.FixityDirection instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Foreign instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.FunDep instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Guard instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Info instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.InjectivityAnn instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Inline instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Lit instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Loc instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Match instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.ModName instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Module instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.ModuleInfo instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Name instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.NameFlavour instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.NameSpace instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.NamespaceSpecifier instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.OccName instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Overlap instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Pat instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.PatSynArgs instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.PatSynDir instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Phases instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.PkgName instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Pragma instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Range instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Role instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.RuleBndr instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.RuleMatch instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Safety instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.SourceStrictness instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.SourceUnpackedness instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Specificity instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Stmt instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.TyLit instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.TySynEqn instance GHC.Internal.Generics.Generic (Language.Haskell.TH.Syntax.TyVarBndr flag) instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.Type instance GHC.Internal.Generics.Generic Language.Haskell.TH.Syntax.TypeFamilyHead instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Addr# instance Language.Haskell.TH.Syntax.Lift GHC.Types.Bool instance Language.Haskell.TH.Syntax.Lift Data.Array.Byte.ByteArray instance Language.Haskell.TH.Syntax.Lift GHC.Types.Char instance Language.Haskell.TH.Syntax.Lift GHC.Types.Double instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (GHC.Internal.Data.Either.Either a b) instance forall k (a :: k). Language.Haskell.TH.Syntax.Lift (Data.Fixed.Fixed a) instance Language.Haskell.TH.Syntax.Lift GHC.Types.Float instance Language.Haskell.TH.Syntax.Lift GHC.Types.Int instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Int.Int16 instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Int.Int32 instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Int.Int64 instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Int.Int8 instance Language.Haskell.TH.Syntax.Lift GHC.Num.Integer.Integer instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift [a] instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (GHC.Internal.Maybe.Maybe a) instance Language.Haskell.TH.Syntax.Lift GHC.Num.Natural.Natural instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (GHC.Internal.Base.NonEmpty a) instance GHC.Internal.Real.Integral a => Language.Haskell.TH.Syntax.Lift (GHC.Internal.Real.Ratio a) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (a, b) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c) => Language.Haskell.TH.Syntax.Lift (a, b, c) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d) => Language.Haskell.TH.Syntax.Lift (a, b, c, d) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e) => Language.Haskell.TH.Syntax.Lift (a, b, c, d, e) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f) => Language.Haskell.TH.Syntax.Lift (a, b, c, d, e, f) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f, Language.Haskell.TH.Syntax.Lift g) => Language.Haskell.TH.Syntax.Lift (a, b, c, d, e, f, g) instance Language.Haskell.TH.Syntax.Lift () instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Base.Void instance Language.Haskell.TH.Syntax.Lift GHC.Types.Word instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Word.Word16 instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Word.Word32 instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Word.Word64 instance Language.Haskell.TH.Syntax.Lift GHC.Internal.Word.Word8 instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Double# instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Float# instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Int# instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (# a | b #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c) => Language.Haskell.TH.Syntax.Lift (# a | b | c #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d | e #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d | e | f #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f, Language.Haskell.TH.Syntax.Lift g) => Language.Haskell.TH.Syntax.Lift (# a | b | c | d | e | f | g #) instance Language.Haskell.TH.Syntax.Lift a => Language.Haskell.TH.Syntax.Lift (# a #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b) => Language.Haskell.TH.Syntax.Lift (# a, b #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c) => Language.Haskell.TH.Syntax.Lift (# a, b, c #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d, e #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d, e, f #) instance (Language.Haskell.TH.Syntax.Lift a, Language.Haskell.TH.Syntax.Lift b, Language.Haskell.TH.Syntax.Lift c, Language.Haskell.TH.Syntax.Lift d, Language.Haskell.TH.Syntax.Lift e, Language.Haskell.TH.Syntax.Lift f, Language.Haskell.TH.Syntax.Lift g) => Language.Haskell.TH.Syntax.Lift (# a, b, c, d, e, f, g #) instance Language.Haskell.TH.Syntax.Lift (# #) instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Char# instance Language.Haskell.TH.Syntax.Lift GHC.Prim.Word# instance GHC.Internal.Control.Monad.Fail.MonadFail Language.Haskell.TH.Syntax.Q instance GHC.Internal.Control.Monad.Fix.MonadFix Language.Haskell.TH.Syntax.Q instance Control.Monad.IO.Class.MonadIO Language.Haskell.TH.Syntax.Q instance GHC.Internal.Base.Monad Language.Haskell.TH.Syntax.Q instance GHC.Internal.Base.Monoid a => GHC.Internal.Base.Monoid (Language.Haskell.TH.Syntax.Q a) instance GHC.Classes.Ord Language.Haskell.TH.Syntax.AnnLookup instance GHC.Classes.Ord Language.Haskell.TH.Syntax.AnnTarget instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Bang instance GHC.Classes.Ord Language.Haskell.TH.Syntax.BndrVis instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Body instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Bytes instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Callconv instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Clause instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Con instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Dec instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DecidedStrictness instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DerivClause instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DerivStrategy instance GHC.Classes.Ord Language.Haskell.TH.Syntax.DocLoc instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Exp instance GHC.Classes.Ord Language.Haskell.TH.Syntax.FamilyResultSig instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Fixity instance GHC.Classes.Ord Language.Haskell.TH.Syntax.FixityDirection instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Foreign instance GHC.Classes.Ord Language.Haskell.TH.Syntax.FunDep instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Guard instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Info instance GHC.Classes.Ord Language.Haskell.TH.Syntax.InjectivityAnn instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Inline instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Lit instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Loc instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Match instance GHC.Classes.Ord Language.Haskell.TH.Syntax.ModName instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Module instance GHC.Classes.Ord Language.Haskell.TH.Syntax.ModuleInfo instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Name instance GHC.Classes.Ord Language.Haskell.TH.Syntax.NameFlavour instance GHC.Classes.Ord Language.Haskell.TH.Syntax.NameSpace instance GHC.Classes.Ord Language.Haskell.TH.Syntax.NamespaceSpecifier instance GHC.Classes.Ord Language.Haskell.TH.Syntax.OccName instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Overlap instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Pat instance GHC.Classes.Ord Language.Haskell.TH.Syntax.PatSynArgs instance GHC.Classes.Ord Language.Haskell.TH.Syntax.PatSynDir instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Phases instance GHC.Classes.Ord Language.Haskell.TH.Syntax.PkgName instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Pragma instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Range instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Role instance GHC.Classes.Ord Language.Haskell.TH.Syntax.RuleBndr instance GHC.Classes.Ord Language.Haskell.TH.Syntax.RuleMatch instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Safety instance GHC.Classes.Ord Language.Haskell.TH.Syntax.SourceStrictness instance GHC.Classes.Ord Language.Haskell.TH.Syntax.SourceUnpackedness instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Specificity instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Stmt instance GHC.Classes.Ord Language.Haskell.TH.Syntax.TyLit instance GHC.Classes.Ord Language.Haskell.TH.Syntax.TySynEqn instance GHC.Classes.Ord flag => GHC.Classes.Ord (Language.Haskell.TH.Syntax.TyVarBndr flag) instance GHC.Classes.Ord Language.Haskell.TH.Syntax.Type instance GHC.Classes.Ord Language.Haskell.TH.Syntax.TypeFamilyHead instance Language.Haskell.TH.Syntax.Quasi GHC.Types.IO instance Language.Haskell.TH.Syntax.Quasi Language.Haskell.TH.Syntax.Q instance Language.Haskell.TH.Syntax.Quote GHC.Types.IO instance Language.Haskell.TH.Syntax.Quote Language.Haskell.TH.Syntax.Q instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Language.Haskell.TH.Syntax.Q a) instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.AnnLookup instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.AnnTarget instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Bang instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.BndrVis instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Body instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Bytes instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Callconv instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Clause instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Con instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Dec instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.DecidedStrictness instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.DerivClause instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.DerivStrategy instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.DocLoc instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Exp instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.FamilyResultSig instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Fixity instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.FixityDirection instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Foreign instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.FunDep instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Guard instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Info instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.InjectivityAnn instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Inline instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Lit instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Loc instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Match instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.ModName instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Module instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.ModuleInfo instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Name instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.NameFlavour instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.NameSpace instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.NamespaceSpecifier instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.OccName instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Overlap instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Pat instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.PatSynArgs instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.PatSynDir instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Phases instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.PkgName instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Pragma instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Range instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Role instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.RuleBndr instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.RuleMatch instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Safety instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.SourceStrictness instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.SourceUnpackedness instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Specificity instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Stmt instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.TyLit instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.TySynEqn instance GHC.Internal.Show.Show flag => GHC.Internal.Show.Show (Language.Haskell.TH.Syntax.TyVarBndr flag) instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.Type instance GHC.Internal.Show.Show Language.Haskell.TH.Syntax.TypeFamilyHead instance GHC.Internal.Data.Traversable.Traversable Language.Haskell.TH.Syntax.TyVarBndr -- | Template Haskell supports quasiquoting, which permits users to -- construct program fragments by directly writing concrete syntax. A -- quasiquoter is essentially a function with takes a string to a -- Template Haskell AST. This module defines the QuasiQuoter -- datatype, which specifies a quasiquoter q which can be -- invoked using the syntax [q| ... string to parse ... |] when -- the QuasiQuotes language extension is enabled, and some -- utility functions for manipulating quasiquoters. Nota bene: this -- package does not define any parsers, that is up to you. module Language.Haskell.TH.Quote -- | The QuasiQuoter type, a value q of this type can be -- used in the syntax [q| ... string to parse ...|]. In fact, -- for convenience, a QuasiQuoter actually defines multiple -- quasiquoters to be used in different splice contexts; if you are only -- interested in defining a quasiquoter to be used for expressions, you -- would define a QuasiQuoter with only quoteExp, and leave -- the other fields stubbed out with errors. data QuasiQuoter QuasiQuoter :: (String -> Q Exp) -> (String -> Q Pat) -> (String -> Q Type) -> (String -> Q [Dec]) -> QuasiQuoter -- | Quasi-quoter for expressions, invoked by quotes like lhs = -- $[q|...] [quoteExp] :: QuasiQuoter -> String -> Q Exp -- | Quasi-quoter for patterns, invoked by quotes like f $[q|...] = -- rhs [quotePat] :: QuasiQuoter -> String -> Q Pat -- | Quasi-quoter for types, invoked by quotes like f :: $[q|...] [quoteType] :: QuasiQuoter -> String -> Q Type -- | Quasi-quoter for declarations, invoked by top-level quotes [quoteDec] :: QuasiQuoter -> String -> Q [Dec] -- | quoteFile takes a QuasiQuoter and lifts it into one that -- read the data out of a file. For example, suppose asmq is an -- assembly-language quoter, so that you can write [asmq| ld r1, r2 |] as -- an expression. Then if you define asmq_f = quoteFile asmq, -- then the quote [asmq_f|foo.s|] will take input from file -- "foo.s" instead of the inline text quoteFile :: QuasiQuoter -> QuasiQuoter -- | dataToQa is an internal utility function for constructing -- generic conversion functions from types with Data instances to -- various quasi-quoting representations. See the source of -- dataToExpQ and dataToPatQ for two example usages: -- mkCon, mkLit and appQ are overloadable to -- account for different syntax for expressions and patterns; -- antiQ allows you to override type-specific cases, a common -- usage is just const Nothing, which results in no overloading. dataToQa :: (Quote m, Data a) => (Name -> k) -> (Lit -> m q) -> (k -> [m q] -> m q) -> (forall b. Data b => b -> Maybe (m q)) -> a -> m q -- | dataToExpQ converts a value to a Exp representation of -- the same value, in the SYB style. It is generalized to take a function -- override type-specific cases; see liftData for a more commonly -- used variant. dataToExpQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Exp)) -> a -> m Exp -- | dataToPatQ converts a value to a Pat representation of -- the same value, in the SYB style. It takes a function to handle -- type-specific cases, alternatively, pass const Nothing to get -- default behavior. dataToPatQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Pat)) -> a -> m Pat -- | Monadic front-end to Text.PrettyPrint module Language.Haskell.TH.PprLib type Doc = PprM Doc data PprM a empty :: Doc semi :: Doc comma :: Doc colon :: Doc dcolon :: Doc space :: Doc equals :: Doc arrow :: Doc lparen :: Doc rparen :: Doc lbrack :: Doc rbrack :: Doc lbrace :: Doc rbrace :: Doc text :: String -> Doc char :: Char -> Doc ptext :: String -> Doc int :: Int -> Doc integer :: Integer -> Doc float :: Float -> Doc double :: Double -> Doc rational :: Rational -> Doc parens :: Doc -> Doc brackets :: Doc -> Doc braces :: Doc -> Doc quotes :: Doc -> Doc doubleQuotes :: Doc -> Doc (<>) :: Doc -> Doc -> Doc infixl 6 <> (<+>) :: Doc -> Doc -> Doc infixl 6 <+> hcat :: [Doc] -> Doc hsep :: [Doc] -> Doc ($$) :: Doc -> Doc -> Doc infixl 5 $$ ($+$) :: Doc -> Doc -> Doc infixl 5 $+$ vcat :: [Doc] -> Doc sep :: [Doc] -> Doc cat :: [Doc] -> Doc fsep :: [Doc] -> Doc fcat :: [Doc] -> Doc nest :: Int -> Doc -> Doc hang :: Doc -> Int -> Doc -> Doc punctuate :: Doc -> [Doc] -> [Doc] isEmpty :: Doc -> PprM Bool to_HPJ_Doc :: Doc -> Doc pprName :: Name -> Doc pprName' :: NameIs -> Name -> Doc instance GHC.Internal.Base.Applicative Language.Haskell.TH.PprLib.PprM instance GHC.Internal.Base.Functor Language.Haskell.TH.PprLib.PprM instance GHC.Internal.Base.Monad Language.Haskell.TH.PprLib.PprM instance GHC.Internal.Show.Show Language.Haskell.TH.PprLib.Doc -- | contains a prettyprinter for the Template Haskell datatypes module Language.Haskell.TH.Ppr nestDepth :: Int type Precedence = Int appPrec :: Precedence opPrec :: Precedence unopPrec :: Precedence funPrec :: Precedence qualPrec :: Precedence sigPrec :: Precedence noPrec :: Precedence parensIf :: Bool -> Doc -> Doc pprint :: Ppr a => a -> String class Ppr a ppr :: Ppr a => a -> Doc ppr_list :: Ppr a => [a] -> Doc ppr_sig :: Name -> Type -> Doc pprFixity :: Name -> Fixity -> NamespaceSpecifier -> Doc pprNamespaceSpecifier :: NamespaceSpecifier -> Doc -- | Pretty prints a pattern synonym type signature pprPatSynSig :: Name -> PatSynType -> Doc -- | Pretty prints a pattern synonym's type; follows the usual conventions -- to print a pattern synonym type compactly, yet unambiguously. See the -- note on PatSynType and the section on pattern synonyms in the -- GHC user's guide for more information. pprPatSynType :: PatSynType -> Doc pprPrefixOcc :: Name -> Doc isSymOcc :: Name -> Bool pprInfixExp :: Exp -> Doc pprExp :: Precedence -> Exp -> Doc pprFields :: [(Name, Exp)] -> Doc pprMaybeExp :: Precedence -> Maybe Exp -> Doc pprMatchPat :: Pat -> Doc pprGuarded :: Doc -> (Guard, Exp) -> Doc pprBody :: Bool -> Body -> Doc pprClause :: Bool -> Clause -> Doc pprLit :: Precedence -> Lit -> Doc bytesToString :: [Word8] -> String pprString :: String -> Doc pprPat :: Precedence -> Pat -> Doc ppr_dec :: Bool -> Dec -> Doc ppr_deriv_strategy :: DerivStrategy -> Doc ppr_overlap :: Overlap -> Doc ppr_data :: Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc ppr_newtype :: Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> Con -> [DerivClause] -> Doc ppr_type_data :: Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc ppr_typedef :: String -> Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc ppr_deriv_clause :: DerivClause -> Doc ppr_tySyn :: Doc -> Maybe Name -> Doc -> Type -> Doc ppr_tf_head :: TypeFamilyHead -> Doc ppr_bndrs :: PprFlag flag => Maybe [TyVarBndr flag] -> Doc commaSepApplied :: [Name] -> Doc pprForall :: [TyVarBndr Specificity] -> Cxt -> Doc pprForallVis :: [TyVarBndr ()] -> Cxt -> Doc pprForall' :: PprFlag flag => ForallVisFlag -> [TyVarBndr flag] -> Cxt -> Doc pprRecFields :: [(Name, Strict, Type)] -> Type -> Doc pprGadtRHS :: [(Strict, Type)] -> Type -> Doc pprVarBangType :: VarBangType -> Doc pprBangType :: BangType -> Doc -- | Deprecated: As of template-haskell-2.11.0.0, -- VarStrictType has been replaced by VarBangType. Please -- use pprVarBangType instead. pprVarStrictType :: (Name, Strict, Type) -> Doc -- | Deprecated: As of template-haskell-2.11.0.0, -- StrictType has been replaced by BangType. Please use -- pprBangType instead. pprStrictType :: (Strict, Type) -> Doc pprType :: Precedence -> Type -> Doc pprParendType :: Type -> Doc pprInfixT :: Precedence -> Type -> Doc pprParendTypeArg :: TypeArg -> Doc isStarT :: Type -> Bool pprTyApp :: Precedence -> (Type, [TypeArg]) -> Doc fromTANormal :: TypeArg -> Maybe Type pprFunArgType :: Type -> Doc data ForallVisFlag ForallVis :: ForallVisFlag ForallInvis :: ForallVisFlag data TypeArg TANormal :: Type -> TypeArg TyArg :: Kind -> TypeArg split :: Type -> (Type, [TypeArg]) pprTyLit :: TyLit -> Doc class PprFlag flag pprTyVarBndr :: PprFlag flag => TyVarBndr flag -> Doc pprBndrVis :: BndrVis -> Doc -> Doc pprCxt :: Cxt -> Doc ppr_cxt_preds :: Precedence -> Cxt -> Doc where_clause :: [Dec] -> Doc showtextl :: Show a => a -> Doc hashParens :: Doc -> Doc quoteParens :: Doc -> Doc sepWith :: Doc -> (a -> Doc) -> [a] -> Doc commaSep :: Ppr a => [a] -> Doc commaSepWith :: (a -> Doc) -> [a] -> Doc semiSep :: Ppr a => [a] -> Doc semiSepWith :: (a -> Doc) -> [a] -> Doc unboxedSumBars :: Doc -> SumAlt -> SumArity -> Doc bar :: Doc instance Language.Haskell.TH.Ppr.PprFlag Language.Haskell.TH.Syntax.BndrVis instance Language.Haskell.TH.Ppr.PprFlag Language.Haskell.TH.Syntax.Specificity instance Language.Haskell.TH.Ppr.PprFlag () instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Bang instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Clause instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Con instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Dec instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.DecidedStrictness instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Exp instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.FamilyResultSig instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Foreign instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.FunDep instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Info instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.InjectivityAnn instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Inline instance Language.Haskell.TH.Ppr.Ppr a => Language.Haskell.TH.Ppr.Ppr [a] instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Lit instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Loc instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Match instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Module instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.ModuleInfo instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Name instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Pat instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.PatSynArgs instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.PatSynDir instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Phases instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Pragma instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Range instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Role instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.RuleBndr instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.RuleMatch instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.SourceStrictness instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.SourceUnpackedness instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Stmt instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.TyLit instance Language.Haskell.TH.Ppr.PprFlag flag => Language.Haskell.TH.Ppr.Ppr (Language.Haskell.TH.Syntax.TyVarBndr flag) instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Syntax.Type instance Language.Haskell.TH.Ppr.Ppr Language.Haskell.TH.Ppr.TypeArg instance GHC.Internal.Show.Show Language.Haskell.TH.Ppr.ForallVisFlag -- | Language.Haskell.TH.Lib.Internal exposes some additional functionality -- that is used internally in GHC's integration with Template Haskell. -- This is not a part of the public API, and as such, there are no API -- guarantees for this module from version to version. module Language.Haskell.TH.Lib.Internal -- | Representation-polymorphic since template-haskell-2.17.0.0. type TExpQ (a :: TYPE r) = Q TExp a type CodeQ = Code Q type InfoQ = Q Info type PatQ = Q Pat type FieldPatQ = Q FieldPat type ExpQ = Q Exp type DecQ = Q Dec type DecsQ = Q [Dec] type Decs = [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 RuleBndrQ = Q RuleBndr type TySynEqnQ = Q TySynEqn type PatSynDirQ = Q PatSynDir type PatSynArgsQ = Q PatSynArgs type FamilyResultSigQ = Q FamilyResultSig type DerivStrategyQ = Q DerivStrategy type Role = Role type InjectivityAnn = InjectivityAnn type TyVarBndrUnit = TyVarBndr () type TyVarBndrSpec = TyVarBndr Specificity type TyVarBndrVis = TyVarBndr BndrVis intPrimL :: Integer -> Lit wordPrimL :: Integer -> Lit floatPrimL :: Rational -> Lit doublePrimL :: Rational -> Lit integerL :: Integer -> Lit charL :: Char -> Lit charPrimL :: Char -> Lit stringL :: String -> Lit stringPrimL :: [Word8] -> Lit bytesPrimL :: Bytes -> Lit rationalL :: Rational -> Lit 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 Type] -> [m Pat] -> m Pat infixP :: Quote m => m Pat -> Name -> m Pat -> m Pat uInfixP :: Quote m => m Pat -> Name -> m Pat -> m Pat parensP :: Quote m => 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 typeP :: Quote m => m Type -> m Pat invisP :: Quote m => m Type -> m Pat viewP :: Quote m => m Exp -> m Pat -> m Pat fieldPat :: Quote m => Name -> m Pat -> m FieldPat 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 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 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) -- | Use with caseE match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match -- | Use with funD clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause -- | Dynamically binding a variable (unhygienic) dyn :: Quote m => String -> m Exp varE :: Quote m => Name -> m Exp conE :: Quote m => Name -> m Exp litE :: Quote m => Lit -> m Exp appE :: Quote m => m Exp -> m Exp -> m Exp appTypeE :: Quote m => m Exp -> m Type -> m Exp parensE :: Quote m => m Exp -> m Exp uInfixE :: Quote m => m Exp -> m Exp -> 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 -- | Single-arg lambda lam1E :: Quote m => m Pat -> m Exp -> m Exp -- | Lambda-case (case) lamCaseE :: Quote m => [m Match] -> m Exp -- | Lambda-cases (cases) lamCasesE :: Quote m => [m Clause] -> m Exp tupE :: Quote m => [Maybe (m Exp)] -> m Exp unboxedTupE :: Quote m => [Maybe (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 doE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp mdoE :: Quote m => Maybe ModName -> [m Stmt] -> m Exp compE :: Quote m => [m Stmt] -> m Exp arithSeqE :: Quote m => m Range -> 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) -- |
--   staticE x = [| static x |]
--   
staticE :: Quote m => m Exp -> m Exp unboundVarE :: Quote m => Name -> m Exp labelE :: Quote m => String -> m Exp implicitParamVarE :: Quote m => String -> m Exp getFieldE :: Quote m => m Exp -> String -> m Exp projectionE :: Quote m => NonEmpty String -> m Exp typedSpliceE :: Quote m => m Exp -> m Exp typedBracketE :: Quote m => m Exp -> m 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 typeE :: Quote m => m Type -> m Exp valD :: Quote m => m Pat -> m Body -> [m Dec] -> m Dec funD :: Quote m => Name -> [m Clause] -> m Dec tySynD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> m Type -> m Dec dataD :: Quote m => m Cxt -> Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> [m Con] -> [m DerivClause] -> m Dec newtypeD :: Quote m => m Cxt -> Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> m Con -> [m DerivClause] -> m Dec typeDataD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> [m Con] -> m Dec classD :: Quote m => m Cxt -> Name -> [m (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 sigD :: Quote m => Name -> m Type -> m Dec kiSigD :: Quote m => Name -> m Kind -> m Dec forImpD :: Quote m => Callconv -> Safety -> String -> Name -> m Type -> m Dec infixLD :: Quote m => Int -> Name -> m Dec infixRD :: Quote m => Int -> Name -> m Dec infixND :: Quote m => Int -> Name -> m Dec infixLWithSpecD :: Quote m => Int -> NamespaceSpecifier -> Name -> m Dec infixRWithSpecD :: Quote m => Int -> NamespaceSpecifier -> Name -> m Dec infixNWithSpecD :: Quote m => Int -> NamespaceSpecifier -> Name -> m Dec defaultD :: Quote m => [m Type] -> m Dec pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec pragOpaqueD :: Quote m => Name -> 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 -> Maybe [m (TyVarBndr ())] -> [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 pragSCCFunD :: Quote m => Name -> m Dec pragSCCFunNamedD :: Quote m => Name -> String -> m Dec dataInstD :: Quote m => m Cxt -> Maybe [m (TyVarBndr ())] -> m Type -> Maybe (m Kind) -> [m Con] -> [m DerivClause] -> m Dec newtypeInstD :: Quote m => m Cxt -> Maybe [m (TyVarBndr ())] -> m Type -> Maybe (m Kind) -> m Con -> [m DerivClause] -> m Dec tySynInstD :: Quote m => m TySynEqn -> m Dec dataFamilyD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> Maybe (m Kind) -> m Dec openTypeFamilyD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> m FamilyResultSig -> Maybe InjectivityAnn -> m Dec closedTypeFamilyD :: Quote m => Name -> [m (TyVarBndr BndrVis)] -> m FamilyResultSig -> Maybe InjectivityAnn -> [m TySynEqn] -> m Dec roleAnnotD :: Quote m => Name -> [Role] -> m Dec standaloneDerivD :: Quote m => m Cxt -> m Type -> m Dec standaloneDerivWithStrategyD :: Quote m => Maybe (m DerivStrategy) -> m Cxt -> m Type -> m Dec defaultSigD :: Quote m => Name -> m Type -> m Dec -- | Pattern synonym declaration patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec -- | Pattern synonym type signature patSynSigD :: Quote m => Name -> m Type -> m Dec -- | Implicit parameter binding declaration. Can only be used in let and -- where clauses which consist entirely of implicit bindings. implicitParamBindD :: Quote m => String -> m Exp -> m Dec tySynEqn :: Quote m => Maybe [m (TyVarBndr ())] -> m Type -> m Type -> m TySynEqn cxt :: Quote m => [m Pred] -> m Cxt derivClause :: Quote m => Maybe (m DerivStrategy) -> [m Pred] -> m DerivClause stockStrategy :: Quote m => m DerivStrategy anyclassStrategy :: Quote m => m DerivStrategy newtypeStrategy :: Quote m => m DerivStrategy viaStrategy :: Quote m => m Type -> m DerivStrategy 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 => [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 forallT :: Quote m => [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 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 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 listT :: Quote m => m Type litT :: Quote m => m TyLit -> 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 -> m Kind -> m Type equalityT :: Quote m => m Type wildCardT :: Quote m => m Type implicitParamT :: Quote m => String -> m Type -> m Type -- | Deprecated: As of template-haskell-2.10, constraint predicates -- (Pred) are just types (Type), in keeping with ConstraintKinds. Please -- use conT and appT. 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 -- see equalityT. equalP :: Quote m => m Type -> m Type -> m Pred promotedT :: Quote m => Name -> m Type promotedTupleT :: Quote m => Int -> m Type promotedNilT :: Quote m => m Type promotedConsT :: Quote m => m Type 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 -- | Deprecated: Use bang. See -- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example -- usage: 'bang noSourceUnpackedness sourceStrict' isStrict :: Quote m => m Strict -- | Deprecated: Use bang. See -- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example -- usage: 'bang noSourceUnpackedness noSourceStrictness' notStrict :: Quote m => m Strict -- | Deprecated: Use bang. See -- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example -- usage: 'bang sourceUnpack sourceStrict' 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 -- | Deprecated: As of template-haskell-2.11.0.0, -- StrictType has been replaced by BangType. Please use -- bangType instead. strictType :: Quote m => m Strict -> m Type -> m StrictType -- | Deprecated: As of template-haskell-2.11.0.0, -- VarStrictType has been replaced by VarBangType. Please -- use varBangType instead. varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType numTyLit :: Quote m => Integer -> m TyLit strTyLit :: Quote m => String -> m TyLit charTyLit :: Quote m => Char -> m TyLit plainTV :: Quote m => Name -> m (TyVarBndr ()) plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity) plainBndrTV :: Quote m => Name -> BndrVis -> m (TyVarBndr BndrVis) kindedTV :: Quote m => Name -> m Kind -> m (TyVarBndr ()) kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity) kindedBndrTV :: Quote m => Name -> BndrVis -> m Kind -> m (TyVarBndr BndrVis) specifiedSpec :: Specificity inferredSpec :: Specificity bndrReq :: BndrVis bndrInvis :: BndrVis varK :: Name -> Kind conK :: Name -> Kind tupleK :: Int -> Kind arrowK :: Kind listK :: Kind appK :: Kind -> Kind -> Kind starK :: Quote m => m Kind constraintK :: Quote m => m Kind noSig :: Quote m => m FamilyResultSig kindSig :: Quote m => m Kind -> m FamilyResultSig tyVarSig :: Quote m => m (TyVarBndr ()) -> m FamilyResultSig injectivityAnn :: Name -> [Name] -> InjectivityAnn nominalR :: Role representationalR :: Role phantomR :: Role inferR :: Role cCall :: Callconv stdCall :: Callconv cApi :: Callconv prim :: Callconv javaScript :: Callconv unsafe :: Safety safe :: Safety interruptible :: Safety 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 unidir :: Quote m => m PatSynDir implBidir :: Quote m => m PatSynDir explBidir :: Quote m => [m Clause] -> m PatSynDir prefixPatSyn :: Quote m => [Name] -> m PatSynArgs recordPatSyn :: Quote m => [Name] -> m PatSynArgs infixPatSyn :: Quote m => Name -> Name -> m PatSynArgs appsE :: Quote m => [m Exp] -> m Exp -- | pure the Module at the place of splicing. Can be used as an input for -- reifyModule. thisModule :: Q Module -- | 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. withDecDoc :: String -> Q Dec -> Q Dec -- | Variant of withDecDoc that applies the same documentation to -- multiple declarations. Useful for documenting quoted declarations. withDecsDoc :: String -> Q [Dec] -> Q [Dec] -- | Variant of funD that attaches Haddock documentation. funD_doc :: Name -> [Q Clause] -> Maybe String -> [Maybe String] -> Q Dec -- | Variant of dataD that attaches Haddock documentation. dataD_doc :: Q Cxt -> Name -> [Q (TyVarBndr BndrVis)] -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of newtypeD that attaches Haddock documentation. newtypeD_doc :: Q Cxt -> Name -> [Q (TyVarBndr BndrVis)] -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of typeDataD that attaches Haddock documentation. typeDataD_doc :: Name -> [Q (TyVarBndr BndrVis)] -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> Maybe String -> Q Dec -- | Variant of dataInstD that attaches Haddock documentation. dataInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of newtypeInstD that attaches Haddock documentation. newtypeInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of patSynD that attaches Haddock documentation. patSynD_doc :: Name -> Q PatSynArgs -> Q PatSynDir -> Q Pat -> Maybe String -> [Maybe String] -> Q Dec -- | Document a data/newtype constructor with its arguments. docCons :: (Q Con, Maybe String, [Maybe String]) -> Q () -- | Language.Haskell.TH.Lib contains lots of useful helper functions for -- generating and manipulating Template Haskell terms module Language.Haskell.TH.Lib type InfoQ = Q Info type ExpQ = Q Exp -- | Representation-polymorphic since template-haskell-2.17.0.0. type TExpQ (a :: TYPE r) = Q TExp a 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 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 type TyVarBndrVis = TyVarBndr BndrVis 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 -- | Create a Bytes datatype representing raw bytes to be embedded into the -- program/library binary. 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 typeP :: Quote m => m Type -> m Pat invisP :: Quote m => m Type -> 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) -- | Use with caseE match :: Quote m => m Pat -> m Body -> [m Dec] -> m Match -- | Use with funD clause :: Quote m => [m Pat] -> m Body -> [m Dec] -> m Clause -- | Dynamically binding a variable (unhygienic) 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 x = [| static x |]
--   
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 -- | Single-arg lambda lam1E :: Quote m => m Pat -> m Exp -> m Exp -- | Lambda-case (case) lamCaseE :: Quote m => [m Match] -> m Exp -- | Lambda-cases (cases) lamCasesE :: Quote m => [m Clause] -> 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) getFieldE :: Quote m => m Exp -> String -> m Exp projectionE :: Quote m => NonEmpty String -> m Exp typedSpliceE :: Quote m => m Exp -> m Exp typedBracketE :: Quote m => m Exp -> m Exp typeE :: Quote m => m Type -> m 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 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 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 charTyLit :: Quote m => Char -> 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 -- | Deprecated: Use bang. See -- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example -- usage: 'bang noSourceUnpackedness sourceStrict' isStrict :: Quote m => m Strict -- | Deprecated: Use bang. See -- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example -- usage: 'bang noSourceUnpackedness noSourceStrictness' notStrict :: Quote m => m Strict -- | Deprecated: Use bang. See -- https://gitlab.haskell.org/ghc/ghc/wikis/migration/8.0. Example -- usage: 'bang sourceUnpack sourceStrict' 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 -- | Deprecated: As of template-haskell-2.11.0.0, -- StrictType has been replaced by BangType. Please use -- bangType instead. strictType :: Quote m => m Strict -> m Type -> m StrictType -- | Deprecated: As of template-haskell-2.11.0.0, -- VarStrictType has been replaced by VarBangType. Please -- use varBangType instead. varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType cxt :: Quote m => [m Pred] -> m Cxt -- | Deprecated: As of template-haskell-2.10, constraint predicates -- (Pred) are just types (Type), in keeping with ConstraintKinds. Please -- use conT and appT. 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 -- see equalityT. 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 class DefaultBndrFlag flag defaultBndrFlag :: DefaultBndrFlag flag => flag plainTV :: DefaultBndrFlag flag => Name -> TyVarBndr flag kindedTV :: DefaultBndrFlag flag => Name -> Kind -> TyVarBndr flag plainInvisTV :: Quote m => Name -> Specificity -> m (TyVarBndr Specificity) kindedInvisTV :: Quote m => Name -> Specificity -> m Kind -> m (TyVarBndr Specificity) plainBndrTV :: Quote m => Name -> BndrVis -> m (TyVarBndr BndrVis) kindedBndrTV :: Quote m => Name -> BndrVis -> m Kind -> m (TyVarBndr BndrVis) specifiedSpec :: Specificity inferredSpec :: Specificity bndrReq :: BndrVis bndrInvis :: BndrVis 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 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 derivClause :: Quote m => Maybe DerivStrategy -> [m Pred] -> m DerivClause -- | A single deriving clause at the end of a datatype. data DerivClause -- |
--   { deriving stock (Eq, Ord) }
--   
DerivClause :: Maybe DerivStrategy -> Cxt -> DerivClause stockStrategy :: Quote m => m DerivStrategy anyclassStrategy :: Quote m => m DerivStrategy newtypeStrategy :: Quote m => m DerivStrategy viaStrategy :: Quote m => m Type -> m DerivStrategy -- | What the user explicitly requests when deriving an instance. data DerivStrategy -- | A "standard" derived instance StockStrategy :: DerivStrategy -- |
--   -XDeriveAnyClass
--   
AnyclassStrategy :: DerivStrategy -- |
--   -XGeneralizedNewtypeDeriving
--   
NewtypeStrategy :: DerivStrategy -- |
--   -XDerivingVia
--   
ViaStrategy :: Type -> DerivStrategy 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 -- | Varieties of allowed instance overlap. data Overlap -- | May be overlapped by more specific instances Overlappable :: Overlap -- | May overlap a more general instance Overlapping :: Overlap -- | Both Overlapping and Overlappable Overlaps :: Overlap -- | Both Overlapping and Overlappable, and pick an arbitrary -- one if multiple choices are available. Incoherent :: Overlap 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 BndrVis] -> Maybe Kind -> m Dec openTypeFamilyD :: Quote m => Name -> [TyVarBndr BndrVis] -> FamilyResultSig -> Maybe InjectivityAnn -> m Dec closedTypeFamilyD :: Quote m => Name -> [TyVarBndr BndrVis] -> 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 defaultD :: Quote m => [m Type] -> 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 -- | Pattern synonym declaration patSynD :: Quote m => Name -> m PatSynArgs -> m PatSynDir -> m Pat -> m Dec -- | Pattern synonym type signature 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 -- | Implicit parameter binding declaration. Can only be used in let and -- where clauses which consist entirely of implicit bindings. implicitParamBindD :: Quote m => String -> m Exp -> m Dec -- | pure the Module at the place of splicing. Can be used as an input for -- reifyModule. thisModule :: Q Module -- | 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. withDecDoc :: String -> Q Dec -> Q Dec -- | Variant of withDecDoc that applies the same documentation to -- multiple declarations. Useful for documenting quoted declarations. withDecsDoc :: String -> Q [Dec] -> Q [Dec] -- | Variant of funD that attaches Haddock documentation. funD_doc :: Name -> [Q Clause] -> Maybe String -> [Maybe String] -> Q Dec -- | Variant of dataD that attaches Haddock documentation. dataD_doc :: Q Cxt -> Name -> [Q (TyVarBndr BndrVis)] -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of newtypeD that attaches Haddock documentation. newtypeD_doc :: Q Cxt -> Name -> [Q (TyVarBndr BndrVis)] -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of typeDataD that attaches Haddock documentation. typeDataD_doc :: Name -> [Q (TyVarBndr BndrVis)] -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> Maybe String -> Q Dec -- | Variant of dataInstD that attaches Haddock documentation. dataInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> [(Q Con, Maybe String, [Maybe String])] -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of newtypeInstD that attaches Haddock documentation. newtypeInstD_doc :: Q Cxt -> Maybe [Q (TyVarBndr ())] -> Q Type -> Maybe (Q Kind) -> (Q Con, Maybe String, [Maybe String]) -> [Q DerivClause] -> Maybe String -> Q Dec -- | Variant of patSynD that attaches Haddock documentation. patSynD_doc :: Name -> Q PatSynArgs -> Q PatSynDir -> Q Pat -> Maybe String -> [Maybe String] -> Q Dec instance Language.Haskell.TH.Lib.DefaultBndrFlag Language.Haskell.TH.Syntax.BndrVis instance Language.Haskell.TH.Lib.DefaultBndrFlag Language.Haskell.TH.Syntax.Specificity instance Language.Haskell.TH.Lib.DefaultBndrFlag () -- | This module exists to work nicely with the QualifiedDo extension. -- --
--   import qualified Language.Haskell.TH.CodeDo as Code
--   
--   myExample :: Monad m => Code m a -> Code m a -> Code m a
--   myExample opt1 opt2 =
--     Code.do
--      x <- someSideEffect               -- This one is of type `M Bool`
--      if x then opt1 else opt2
--   
module Language.Haskell.TH.CodeDo -- | Module over monad operator for Code (>>=) :: Monad m => m a -> (a -> Code m b) -> Code m b (>>) :: Monad m => m a -> Code m b -> Code m b -- | The public face of Template Haskell -- -- For other documentation, refer to: -- https://wiki.haskell.org/Template_Haskell module Language.Haskell.TH data Q a runQ :: Quasi m => Q a -> m a -- | The Quote class implements the minimal interface which is -- necessary for desugaring quotations. -- -- -- -- Therefore the type of an untyped quotation in GHC is `Quote m => m -- Exp` -- -- For many years the type of a quotation was fixed to be `Q Exp` but by -- more precisely specifying the minimal interface it enables the -- Exp to be extracted purely from the quotation without -- interacting with Q. class Monad m => Quote (m :: Type -> Type) -- | Generate a fresh name, which cannot be captured. -- -- For example, this: -- --
--   f = $(do
--       nm1 <- newName "x"
--       let nm2 = mkName "x"
--       return (LamE [VarP nm1] (LamE [VarP nm2] (VarE nm1)))
--      )
--   
-- -- will produce the splice -- --
--   f = \x0 -> \x -> x0
--   
-- -- In particular, the occurrence VarE nm1 refers to the binding -- VarP nm1, and is not captured by the binding VarP -- nm2. -- -- Although names generated by newName cannot be -- captured, they can capture other names. For example, this: -- --
--   g = $(do
--     nm1 <- newName "x"
--     let nm2 = mkName "x"
--     return (LamE [VarP nm2] (LamE [VarP nm1] (VarE nm2)))
--    )
--   
-- -- will produce the splice -- --
--   g = \x -> \x0 -> x0
--   
-- -- since the occurrence VarE nm2 is captured by the innermost -- binding of x, namely VarP nm1. newName :: Quote m => String -> m Name -- | Report an error to the user, but allow the current splice's -- computation to carry on. To abort the computation, use fail. reportError :: String -> Q () -- | Report a warning to the user, and carry on. reportWarning :: String -> Q () -- | Report an error (True) or warning (False), but carry on; use -- fail to stop. -- | Deprecated: Use reportError or reportWarning instead report :: Bool -> String -> Q () -- | Recover from errors raised by reportError or fail. recover :: Q a -> Q a -> Q a -- | The location at which this computation is spliced. location :: Q Loc data Loc Loc :: String -> String -> String -> CharPos -> CharPos -> Loc [loc_filename] :: Loc -> String [loc_package] :: Loc -> String [loc_module] :: Loc -> String [loc_start] :: Loc -> CharPos [loc_end] :: Loc -> CharPos -- | The runIO function lets you run an I/O computation in the -- Q monad. Take care: you are guaranteed the ordering of calls to -- runIO within a single Q computation, but not about the -- order in which splices are run. -- -- Note: for various murky reasons, stdout and stderr handles are not -- necessarily flushed when the compiler finishes running, so you should -- flush them yourself. runIO :: IO a -> Q a -- | reify looks up information about the Name. It will fail -- with a compile error if the Name is not visible. A Name -- is visible if it is imported or defined in a prior top-level -- declaration group. See the documentation for -- newDeclarationGroup for more details. -- -- It is sometimes useful to construct the argument name using -- lookupTypeName or lookupValueName to ensure that we are -- reifying from the right namespace. For instance, in this context: -- --
--   data D = D
--   
-- -- which D does reify (mkName "D") return information -- about? (Answer: D-the-type, but don't rely on it.) To ensure -- we get information about D-the-value, use -- lookupValueName: -- --
--   do
--     Just nm <- lookupValueName "D"
--     reify nm
--   
-- -- and to get information about D-the-type, use -- lookupTypeName. reify :: Name -> Q Info -- | reifyModule mod looks up information about module -- mod. To look up the current module, call this function with -- the return value of thisModule. reifyModule :: Module -> Q ModuleInfo -- | Template Haskell is capable of reifying information about types and -- terms defined in previous declaration groups. Top-level declaration -- splices break up declaration groups. -- -- For an example, consider this code block. We define a datatype -- X and then try to call reify on the datatype. -- --
--   module Check where
--   
--   data X = X
--       deriving Eq
--   
--   $(do
--       info <- reify ''X
--       runIO $ print info
--    )
--   
-- -- This code fails to compile, noting that X is not available -- for reification at the site of reify. We can fix this by -- creating a new declaration group using an empty top-level splice: -- --
--   data X = X
--       deriving Eq
--   
--   $(pure [])
--   
--   $(do
--       info <- reify ''X
--       runIO $ print info
--    )
--   
-- -- We provide newDeclarationGroup as a means of documenting this -- behavior and providing a name for the pattern. -- -- Since top level splices infer the presence of the $( ... ) -- brackets, we can also write: -- --
--   data X = X
--       deriving Eq
--   
--   newDeclarationGroup
--   
--   $(do
--       info <- reify ''X
--       runIO $ print info
--    )
--   
newDeclarationGroup :: Q [Dec] -- | Obtained from reify in the Q Monad. data Info -- | A class, with a list of its visible instances ClassI :: Dec -> [InstanceDec] -> Info -- | A class method ClassOpI :: Name -> Type -> ParentName -> Info -- | A "plain" type constructor. "Fancier" type constructors are returned -- using PrimTyConI or FamilyI as appropriate. At present, -- this reified declaration will never have derived instances attached to -- it (if you wish to check for an instance, see reifyInstances). TyConI :: Dec -> Info -- | A type or data family, with a list of its visible instances. A closed -- type family is returned with 0 instances. FamilyI :: Dec -> [InstanceDec] -> Info -- | A "primitive" type constructor, which can't be expressed with a -- Dec. Examples: (->), Int#. PrimTyConI :: Name -> Arity -> Unlifted -> Info -- | A data constructor DataConI :: Name -> Type -> ParentName -> Info -- | A pattern synonym PatSynI :: Name -> PatSynType -> Info -- | A "value" variable (as opposed to a type variable, see TyVarI). -- -- The Maybe Dec field contains Just the declaration -- which defined the variable - including the RHS of the declaration - or -- else Nothing, in the case where the RHS is unavailable to the -- compiler. At present, this value is always Nothing: -- returning the RHS has not yet been implemented because of lack of -- interest. VarI :: Name -> Type -> Maybe Dec -> Info -- | A type variable. -- -- The Type field contains the type which underlies the -- variable. At present, this is always VarT theName, but -- future changes may permit refinement of this. TyVarI :: Name -> Type -> Info -- | Obtained from reifyModule in the Q Monad. data ModuleInfo -- | Contains the import list of the module. ModuleInfo :: [Module] -> ModuleInfo -- | InstanceDec describes a single instance of a class or type -- function. It is just a Dec, but guaranteed to be one of the -- following: -- -- type InstanceDec = Dec -- | In ClassOpI and DataConI, name of the parent class or -- type type ParentName = Name -- | In UnboxedSumE and UnboxedSumP, the number associated -- with a particular data constructor. SumAlts are one-indexed and -- should never exceed the value of its corresponding SumArity. -- For example: -- -- type SumAlt = Int -- | In UnboxedSumE, UnboxedSumT, and UnboxedSumP, the -- total number of SumAlts. For example, (#|#) has a -- SumArity of 2. type SumArity = Int -- | In PrimTyConI, arity of the type constructor type Arity = Int -- | In PrimTyConI, is the type constructor unlifted? type Unlifted = Bool -- | The language extensions known to GHC. -- -- Note that there is an orphan Binary instance for this type -- supplied by the GHC.LanguageExtensions module provided by -- ghc-boot. We can't provide here as this would require adding -- transitive dependencies to the template-haskell package, -- which must have a minimal dependency set. data Extension Cpp :: Extension OverlappingInstances :: Extension UndecidableInstances :: Extension IncoherentInstances :: Extension UndecidableSuperClasses :: Extension MonomorphismRestriction :: Extension MonoLocalBinds :: Extension DeepSubsumption :: Extension RelaxedPolyRec :: Extension ExtendedDefaultRules :: Extension ForeignFunctionInterface :: Extension UnliftedFFITypes :: Extension InterruptibleFFI :: Extension CApiFFI :: Extension GHCForeignImportPrim :: Extension JavaScriptFFI :: Extension ParallelArrays :: Extension Arrows :: Extension TemplateHaskell :: Extension TemplateHaskellQuotes :: Extension QualifiedDo :: Extension QuasiQuotes :: Extension ImplicitParams :: Extension ImplicitPrelude :: Extension ScopedTypeVariables :: Extension AllowAmbiguousTypes :: Extension UnboxedTuples :: Extension UnboxedSums :: Extension UnliftedNewtypes :: Extension UnliftedDatatypes :: Extension BangPatterns :: Extension TypeFamilies :: Extension TypeFamilyDependencies :: Extension TypeInType :: Extension OverloadedStrings :: Extension OverloadedLists :: Extension NumDecimals :: Extension DisambiguateRecordFields :: Extension RecordWildCards :: Extension NamedFieldPuns :: Extension ViewPatterns :: Extension GADTs :: Extension GADTSyntax :: Extension NPlusKPatterns :: Extension DoAndIfThenElse :: Extension BlockArguments :: Extension RebindableSyntax :: Extension ConstraintKinds :: Extension PolyKinds :: Extension DataKinds :: Extension TypeData :: Extension InstanceSigs :: Extension ApplicativeDo :: Extension LinearTypes :: Extension RequiredTypeArguments :: Extension StandaloneDeriving :: Extension DeriveDataTypeable :: Extension AutoDeriveTypeable :: Extension DeriveFunctor :: Extension DeriveTraversable :: Extension DeriveFoldable :: Extension DeriveGeneric :: Extension DefaultSignatures :: Extension DeriveAnyClass :: Extension DeriveLift :: Extension DerivingStrategies :: Extension DerivingVia :: Extension TypeSynonymInstances :: Extension FlexibleContexts :: Extension FlexibleInstances :: Extension ConstrainedClassMethods :: Extension MultiParamTypeClasses :: Extension NullaryTypeClasses :: Extension FunctionalDependencies :: Extension UnicodeSyntax :: Extension ExistentialQuantification :: Extension MagicHash :: Extension EmptyDataDecls :: Extension KindSignatures :: Extension RoleAnnotations :: Extension ParallelListComp :: Extension TransformListComp :: Extension MonadComprehensions :: Extension GeneralizedNewtypeDeriving :: Extension RecursiveDo :: Extension PostfixOperators :: Extension TupleSections :: Extension PatternGuards :: Extension LiberalTypeSynonyms :: Extension RankNTypes :: Extension ImpredicativeTypes :: Extension TypeOperators :: Extension ExplicitNamespaces :: Extension PackageImports :: Extension ExplicitForAll :: Extension AlternativeLayoutRule :: Extension AlternativeLayoutRuleTransitional :: Extension DatatypeContexts :: Extension NondecreasingIndentation :: Extension RelaxedLayout :: Extension TraditionalRecordSyntax :: Extension LambdaCase :: Extension MultiWayIf :: Extension BinaryLiterals :: Extension NegativeLiterals :: Extension HexFloatLiterals :: Extension DuplicateRecordFields :: Extension OverloadedLabels :: Extension EmptyCase :: Extension PatternSynonyms :: Extension PartialTypeSignatures :: Extension NamedWildCards :: Extension StaticPointers :: Extension TypeApplications :: Extension Strict :: Extension StrictData :: Extension EmptyDataDeriving :: Extension NumericUnderscores :: Extension QuantifiedConstraints :: Extension StarIsType :: Extension ImportQualifiedPost :: Extension CUSKs :: Extension StandaloneKindSignatures :: Extension LexicalNegation :: Extension FieldSelectors :: Extension OverloadedRecordDot :: Extension OverloadedRecordUpdate :: Extension TypeAbstractions :: Extension ExtendedLiterals :: Extension ListTuplePuns :: Extension -- | List all enabled language extensions. extsEnabled :: Q [Extension] -- | Determine whether the given language extension is enabled in the -- Q monad. isExtEnabled :: Extension -> Q Bool -- | Look up the given name in the (type namespace of the) current splice's -- scope. See Language.Haskell.TH.Syntax#namelookup for more -- details. lookupTypeName :: String -> Q (Maybe Name) -- | Look up the given name in the (value namespace of the) current -- splice's scope. See Language.Haskell.TH.Syntax#namelookup for -- more details. lookupValueName :: String -> Q (Maybe Name) -- | reifyFixity nm attempts to find a fixity declaration for -- nm. For example, if the function foo has the fixity -- declaration infixr 7 foo, then reifyFixity 'foo -- would return Just (Fixity 7 InfixR). If -- the function bar does not have a fixity declaration, then -- reifyFixity 'bar returns Nothing, so you may assume -- bar has defaultFixity. reifyFixity :: Name -> Q (Maybe Fixity) -- | reifyType nm attempts to find the type or kind of -- nm. For example, reifyType 'not returns Bool -- -> Bool, and reifyType ''Bool returns Type. -- This works even if there's no explicit signature and the type or kind -- is inferred. reifyType :: Name -> Q Type -- | reifyInstances nm tys returns a list of all visible instances -- (see below for "visible") of nm tys. That is, if nm -- is the name of a type class, then all instances of this class at the -- types tys are returned. Alternatively, if nm is the -- name of a data family or type family, all instances of this family at -- the types tys are returned. -- -- Note that this is a "shallow" test; the declarations returned merely -- have instance heads which unify with nm tys, they need not -- actually be satisfiable. -- -- -- -- There is one edge case: reifyInstances ''Typeable tys -- currently always produces an empty list (no matter what tys -- are given). -- -- In principle, the *visible* instances are * all instances defined in a -- prior top-level declaration group (see docs on -- newDeclarationGroup), or * all instances defined in any -- module transitively imported by the module being compiled -- -- However, actually searching all modules transitively below the one -- being compiled is unreasonably expensive, so reifyInstances -- will report only the instance for modules that GHC has had some cause -- to visit during this compilation. This is a shortcoming: -- reifyInstances might fail to report instances for a type that -- is otherwise unusued, or instances defined in a different component. -- You can work around this shortcoming by explicitly importing the -- modules whose instances you want to be visible. GHC issue -- #20529 has some discussion around this. reifyInstances :: Name -> [Type] -> Q [InstanceDec] -- | Is the list of instances returned by reifyInstances nonempty? -- -- If you're confused by an instance not being visible despite being -- defined in the same module and above the splice in question, see the -- docs for newDeclarationGroup for a possible explanation. isInstance :: Name -> [Type] -> Q Bool -- | reifyRoles nm returns the list of roles associated with the -- parameters (both visible and invisible) of the tycon nm. -- Fails if nm cannot be found or is not a tycon. The returned -- list should never contain InferR. -- -- An invisible parameter to a tycon is often a kind parameter. For -- example, if we have -- --
--   type Proxy :: forall k. k -> Type
--   data Proxy a = MkProxy
--   
-- -- and reifyRoles Proxy, we will get [NominalR, -- PhantomR]. The NominalR is the role of the -- invisible k parameter. Kind parameters are always nominal. reifyRoles :: Name -> Q [Role] -- | reifyAnnotations target returns the list of annotations -- associated with target. Only the annotations that are -- appropriately typed is returned. So if you have Int and -- String annotations for the same target, you have to call this -- function twice. reifyAnnotations :: Data a => AnnLookup -> Q [a] -- | Annotation target for reifyAnnotations data AnnLookup AnnLookupModule :: Module -> AnnLookup AnnLookupName :: Name -> AnnLookup -- | reifyConStrictness nm looks up the strictness information for -- the fields of the constructor with the name nm. Note that the -- strictness information that reifyConStrictness returns may not -- correspond to what is written in the source code. For example, in the -- following data declaration: -- --
--   data Pair a = Pair a a
--   
-- -- reifyConStrictness would return [DecidedLazy, -- DecidedLazy] under most circumstances, but it would return -- [DecidedStrict, DecidedStrict] if the -- -XStrictData language extension was enabled. reifyConStrictness :: Name -> Q [DecidedStrictness] -- | Typed wrapper around an Exp. -- -- This is the typed representation of terms produced by typed quotes. -- -- Representation-polymorphic since template-haskell-2.16.0.0. data TExp (a :: TYPE r) -- | Underlying untyped Template Haskell expression unType :: TExp a -> Exp -- | Represents an expression which has type a, built in monadic -- context m. Built on top of TExp, typed expressions -- allow for type-safe splicing via: -- -- -- -- Traditional expression quotes and splices let us construct ill-typed -- expressions: -- --
--   >>> fmap ppr $ runQ (unTypeCode [| True == $( [| "foo" |] ) |])
--   GHC.Types.True GHC.Classes.== "foo"
--   
--   >>> GHC.Types.True GHC.Classes.== "foo"
--   <interactive> error:
--       • Couldn't match expected type ‘Bool’ with actual type ‘[Char]’
--       • In the second argument of ‘(==)’, namely ‘"foo"’
--         In the expression: True == "foo"
--         In an equation for ‘it’: it = True == "foo"
--   
-- -- With typed expressions, the type error occurs when constructing -- the Template Haskell expression: -- --
--   >>> fmap ppr $ runQ (unTypeCode [|| True == $$( [|| "foo" ||] ) ||])
--   <interactive> error:
--       • Couldn't match type ‘[Char]’ with ‘Bool’
--         Expected type: Code Q Bool
--           Actual type: Code Q [Char]
--       • In the Template Haskell quotation [|| "foo" ||]
--         In the expression: [|| "foo" ||]
--         In the Template Haskell splice $$([|| "foo" ||])
--   
newtype Code (m :: Type -> Type) (a :: TYPE r) Code :: m (TExp a) -> Code (m :: Type -> Type) (a :: TYPE r) -- | Underlying monadic value [examineCode] :: Code (m :: Type -> Type) (a :: TYPE r) -> m (TExp a) -- | Extract the untyped representation from the typed representation unTypeCode :: forall a m. Quote m => Code m a -> m Exp -- | Unsafely convert an untyped code representation into a typed code -- representation. unsafeCodeCoerce :: forall a m. Quote m => m Exp -> Code m a -- | Modify the ambient monad used during code generation. For example, you -- can use hoistCode to handle a state effect: handleState :: -- Code (StateT Int Q) a -> Code Q a handleState = hoistCode (flip -- runState 0) hoistCode :: Monad m => (forall x. () => m x -> n x) -> Code m a -> Code n a -- | Variant of (>>=) which allows effectful computations to be -- injected into code generation. bindCode :: Monad m => m a -> (a -> Code m b) -> Code m b -- | Variant of (>>) which allows effectful computations to be -- injected into code generation. bindCode_ :: Monad m => m a -> Code m b -> Code m b -- | A useful combinator for embedding monadic actions into Code -- myCode :: ... => Code m a myCode = joinCode $ do x <- -- someSideEffect return (makeCodeWith x) joinCode :: Monad m => m (Code m a) -> Code m a -- | Lift a monadic action producing code into the typed Code -- representation liftCode :: forall a m. m (TExp a) -> Code m a -- | An abstract type representing names in the syntax tree. -- -- Names can be constructed in several ways, which come with -- different name-capture guarantees (see -- Language.Haskell.TH.Syntax#namecapture for an explanation of -- name capture): -- -- -- -- Names constructed using newName and mkName may be -- used in bindings (such as let x = ... or x -> -- ...), but names constructed using lookupValueName, -- lookupTypeName, 'f, ''T may not. data Name data NameSpace -- | Generate a capturable name. Occurrences of such names will be resolved -- according to the Haskell scoping rules at the occurrence site. -- -- For example: -- --
--   f = [| pi + $(varE (mkName "pi")) |]
--   ...
--   g = let pi = 3 in $f
--   
-- -- In this case, g is desugared to -- --
--   g = Prelude.pi + 3
--   
-- -- Note that mkName may be used with qualified names: -- --
--   mkName "Prelude.pi"
--   
-- -- See also dyn for a useful combinator. The above example could -- be rewritten using dyn as -- --
--   f = [| pi + $(dyn "pi") |]
--   
mkName :: String -> Name -- | The name without its module prefix. -- --

Examples

-- --
--   >>> nameBase ''Data.Either.Either
--   "Either"
--   
--   >>> nameBase (mkName "foo")
--   "foo"
--   
--   >>> nameBase (mkName "Module.foo")
--   "foo"
--   
nameBase :: Name -> String -- | Module prefix of a name, if it exists. -- --

Examples

-- --
--   >>> nameModule ''Data.Either.Either
--   Just "Data.Either"
--   
--   >>> nameModule (mkName "foo")
--   Nothing
--   
--   >>> nameModule (mkName "Module.foo")
--   Just "Module"
--   
nameModule :: Name -> Maybe String -- | A name's package, if it exists. -- --

Examples

-- --
--   >>> namePackage ''Data.Either.Either
--   Just "base"
--   
--   >>> namePackage (mkName "foo")
--   Nothing
--   
--   >>> namePackage (mkName "Module.foo")
--   Nothing
--   
namePackage :: Name -> Maybe String -- | Returns whether a name represents an occurrence of a top-level -- variable (VarName), data constructor (DataName), type -- constructor, or type class (TcClsName). If we can't be sure, it -- returns Nothing. -- --

Examples

-- --
--   >>> nameSpace 'Prelude.id
--   Just VarName
--   
--   >>> nameSpace (mkName "id")
--   Nothing -- only works for top-level variable names
--   
--   >>> nameSpace 'Data.Maybe.Just
--   Just DataName
--   
--   >>> nameSpace ''Data.Maybe.Maybe
--   Just TcClsName
--   
--   >>> nameSpace ''Data.Ord.Ord
--   Just TcClsName
--   
nameSpace :: Name -> Maybe NameSpace -- | Tuple type constructor tupleTypeName :: Int -> Name -- | Tuple data constructor tupleDataName :: Int -> Name -- | Unboxed tuple type constructor unboxedTupleTypeName :: Int -> Name -- | Unboxed tuple data constructor unboxedTupleDataName :: Int -> Name -- | Unboxed sum type constructor unboxedSumTypeName :: SumArity -> Name -- | Unboxed sum data constructor unboxedSumDataName :: SumAlt -> SumArity -> Name data Dec -- |
--   { f p1 p2 = b where decs }
--   
FunD :: Name -> [Clause] -> Dec -- |
--   { p = b where decs }
--   
ValD :: Pat -> Body -> [Dec] -> Dec -- |
--   { data Cxt x => T x = A x | B (T x)
--          deriving (Z,W)
--          deriving stock Eq }
--   
DataD :: Cxt -> Name -> [TyVarBndr BndrVis] -> Maybe Kind -> [Con] -> [DerivClause] -> Dec -- |
--   { newtype Cxt x => T x = A (B x)
--          deriving (Z,W Q)
--          deriving stock Eq }
--   
NewtypeD :: Cxt -> Name -> [TyVarBndr BndrVis] -> Maybe Kind -> Con -> [DerivClause] -> Dec -- |
--   { type data T x = A x | B (T x) }
--   
TypeDataD :: Name -> [TyVarBndr BndrVis] -> Maybe Kind -> [Con] -> Dec -- |
--   { type T x = (x,x) }
--   
TySynD :: Name -> [TyVarBndr BndrVis] -> Type -> Dec -- |
--   { class Eq a => Ord a where ds }
--   
ClassD :: Cxt -> Name -> [TyVarBndr BndrVis] -> [FunDep] -> [Dec] -> Dec -- |
--   { instance {-# OVERLAPS #-}
--           Show w => Show [w] where ds }
--   
InstanceD :: Maybe Overlap -> Cxt -> Type -> [Dec] -> Dec -- |
--   { length :: [a] -> Int }
--   
SigD :: Name -> Type -> Dec -- |
--   { type TypeRep :: k -> Type }
--   
KiSigD :: Name -> Kind -> Dec -- |
--   { foreign import ... }
--   { foreign export ... }
--   
ForeignD :: Foreign -> Dec -- |
--   { infix 3 data foo }
--   
InfixD :: Fixity -> NamespaceSpecifier -> Name -> Dec -- |
--   { default (Integer, Double) }
--   
DefaultD :: [Type] -> Dec -- | pragmas PragmaD :: Pragma -> Dec -- | data families (may also appear in [Dec] of ClassD and -- InstanceD) DataFamilyD :: Name -> [TyVarBndr BndrVis] -> Maybe Kind -> Dec -- |
--   { data instance Cxt x => T [x]
--          = A x | B (T x)
--          deriving (Z,W)
--          deriving stock Eq }
--   
DataInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> [Con] -> [DerivClause] -> Dec -- |
--   { newtype instance Cxt x => T [x]
--           = A (B x)
--           deriving (Z,W)
--           deriving stock Eq }
--   
NewtypeInstD :: Cxt -> Maybe [TyVarBndr ()] -> Type -> Maybe Kind -> Con -> [DerivClause] -> Dec -- |
--   { type instance ... }
--   
TySynInstD :: TySynEqn -> Dec -- | open type families (may also appear in [Dec] of ClassD and -- InstanceD) OpenTypeFamilyD :: TypeFamilyHead -> Dec -- |
--   { type family F a b = (r :: *) | r -> a where ... }
--   
ClosedTypeFamilyD :: TypeFamilyHead -> [TySynEqn] -> Dec -- |
--   { type role T nominal representational }
--   
RoleAnnotD :: Name -> [Role] -> Dec -- |
--   { deriving stock instance Ord a => Ord (Foo a) }
--   
StandaloneDerivD :: Maybe DerivStrategy -> Cxt -> Type -> Dec -- |
--   { default size :: Data a => a -> Int }
--   
DefaultSigD :: Name -> Type -> Dec -- | Pattern Synonyms PatSynD :: Name -> PatSynArgs -> PatSynDir -> Pat -> Dec -- | A pattern synonym's type signature. PatSynSigD :: Name -> PatSynType -> Dec -- |
--   { ?x = expr }
--   
-- -- Implicit parameter binding declaration. Can only be used in let and -- where clauses which consist entirely of implicit bindings. ImplicitParamBindD :: String -> Exp -> Dec -- | A data constructor. -- -- The constructors for Con can roughly be divided up into two -- categories: those for constructors with "vanilla" syntax -- (NormalC, RecC, and InfixC), and those for -- constructors with GADT syntax (GadtC and RecGadtC). The -- ForallC constructor, which quantifies additional type variables -- and class contexts, can surround either variety of constructor. -- However, the type variables that it quantifies are different depending -- on what constructor syntax is used: -- -- -- --
--   data Foo a = forall b. MkFoo a b
--   
--   
-- -- In MkFoo, ForallC will quantify b, but not -- a. -- -- -- --
--   data Bar a b where
--     MkBar :: (a ~ b) => c -> MkBar a b
--   
--   
-- -- In MkBar, ForallC will quantify a, -- b, and c. -- -- Multiplicity annotations for data types are currently not supported in -- Template Haskell (i.e. all fields represented by Template Haskell will -- be linear). data Con -- |
--   C Int a
--   
NormalC :: Name -> [BangType] -> Con -- |
--   C { v :: Int, w :: a }
--   
RecC :: Name -> [VarBangType] -> Con -- |
--   Int :+ a
--   
InfixC :: BangType -> Name -> BangType -> Con -- |
--   forall a. Eq a => C [a]
--   
ForallC :: [TyVarBndr Specificity] -> Cxt -> Con -> Con GadtC :: [Name] -> [BangType] -> Type -> Con -- |
--   C :: { v :: Int } -> T b Int
--   
RecGadtC :: [Name] -> [VarBangType] -> Type -> Con data Clause -- |
--   f { p1 p2 = body where decs }
--   
Clause :: [Pat] -> Body -> [Dec] -> Clause -- | SourceUnpackedness corresponds to unpack annotations found in -- the source code. -- -- This may not agree with the annotations returned by -- reifyConStrictness. See reifyConStrictness for more -- information. data SourceUnpackedness -- |
--   C a
--   
NoSourceUnpackedness :: SourceUnpackedness -- |
--   C { {-# NOUNPACK #-} } a
--   
SourceNoUnpack :: SourceUnpackedness -- |
--   C { {-# UNPACK #-} } a
--   
SourceUnpack :: SourceUnpackedness -- | SourceStrictness corresponds to strictness annotations found in -- the source code. -- -- This may not agree with the annotations returned by -- reifyConStrictness. See reifyConStrictness for more -- information. data SourceStrictness -- |
--   C a
--   
NoSourceStrictness :: SourceStrictness -- |
--   C {~}a
--   
SourceLazy :: SourceStrictness -- |
--   C {!}a
--   
SourceStrict :: SourceStrictness -- | Unlike SourceStrictness and SourceUnpackedness, -- DecidedStrictness refers to the strictness annotations that the -- compiler chooses for a data constructor field, which may be different -- from what is written in source code. -- -- Note that non-unpacked strict fields are assigned DecidedLazy -- when a bang would be inappropriate, such as the field of a newtype -- constructor and fields that have an unlifted type. -- -- See reifyConStrictness for more information. data DecidedStrictness -- | Field inferred to not have a bang. DecidedLazy :: DecidedStrictness -- | Field inferred to have a bang. DecidedStrict :: DecidedStrictness -- | Field inferred to be unpacked. DecidedUnpack :: DecidedStrictness data Bang -- |
--   C { {-# UNPACK #-} !}a
--   
Bang :: SourceUnpackedness -> SourceStrictness -> Bang -- | As of template-haskell-2.11.0.0, Strict has been -- replaced by Bang. type Strict = Bang data Foreign ImportF :: Callconv -> Safety -> String -> Name -> Type -> Foreign ExportF :: Callconv -> String -> Name -> Type -> Foreign data Callconv CCall :: Callconv StdCall :: Callconv CApi :: Callconv Prim :: Callconv JavaScript :: Callconv data Safety Unsafe :: Safety Safe :: Safety Interruptible :: Safety data Pragma InlineP :: Name -> Inline -> RuleMatch -> Phases -> Pragma OpaqueP :: Name -> Pragma SpecialiseP :: Name -> Type -> Maybe Inline -> Phases -> Pragma SpecialiseInstP :: Type -> Pragma RuleP :: String -> Maybe [TyVarBndr ()] -> [RuleBndr] -> Exp -> Exp -> Phases -> Pragma AnnP :: AnnTarget -> Exp -> Pragma LineP :: Int -> String -> Pragma -- |
--   { {-# COMPLETE C_1, ..., C_i [ :: T ] #-} }
--   
CompleteP :: [Name] -> Maybe Name -> Pragma -- |
--   { {-# SCC fun "optional_name" #-} }
--   
SCCP :: Name -> Maybe String -> Pragma data Inline NoInline :: Inline Inline :: Inline Inlinable :: Inline data RuleMatch ConLike :: RuleMatch FunLike :: RuleMatch data Phases AllPhases :: Phases FromPhase :: Int -> Phases BeforePhase :: Int -> Phases data RuleBndr RuleVar :: Name -> RuleBndr TypedRuleVar :: Name -> Type -> RuleBndr data AnnTarget ModuleAnnotation :: AnnTarget TypeAnnotation :: Name -> AnnTarget ValueAnnotation :: Name -> AnnTarget data FunDep FunDep :: [Name] -> [Name] -> FunDep -- | One equation of a type family instance or closed type family. The -- arguments are the left-hand-side type and the right-hand-side result. -- -- For instance, if you had the following type family: -- --
--   type family Foo (a :: k) :: k where
--     forall k (a :: k). Foo @k a = a
--   
-- -- The Foo @k a = a equation would be represented as follows: -- --
--   TySynEqn (Just [PlainTV k, KindedTV a (VarT k)])
--              (AppT (AppKindT (ConT ''Foo) (VarT k)) (VarT a))
--              (VarT a)
--   
data TySynEqn TySynEqn :: Maybe [TyVarBndr ()] -> Type -> Type -> TySynEqn -- | Common elements of OpenTypeFamilyD and -- ClosedTypeFamilyD. By analogy with "head" for type classes and -- type class instances as defined in Type classes: an exploration of -- the design space, the TypeFamilyHead is defined to be the -- elements of the declaration between type family and -- where. data TypeFamilyHead TypeFamilyHead :: Name -> [TyVarBndr BndrVis] -> FamilyResultSig -> Maybe InjectivityAnn -> TypeFamilyHead data Fixity Fixity :: Int -> FixityDirection -> Fixity data FixityDirection InfixL :: FixityDirection InfixR :: FixityDirection InfixN :: FixityDirection -- | A way to specify a namespace to look in when GHC needs to find a -- name's source data NamespaceSpecifier -- | Name may be everything; If there are two names in different -- namespaces, then consider both NoNamespaceSpecifier :: NamespaceSpecifier -- | Name should be a type-level entity, such as a data type, type alias, -- type family, type class, or type variable TypeNamespaceSpecifier :: NamespaceSpecifier -- | Name should be a term-level entity, such as a function, data -- constructor, or pattern synonym DataNamespaceSpecifier :: NamespaceSpecifier -- | Default fixity: infixl 9 defaultFixity :: Fixity -- | Highest allowed operator precedence for Fixity constructor -- (answer: 9) maxPrecedence :: Int -- | A pattern synonym's directionality. data PatSynDir -- |
--   pattern P x {<-} p
--   
Unidir :: PatSynDir -- |
--   pattern P x {=} p
--   
ImplBidir :: PatSynDir -- |
--   pattern P x {<-} p where P x = e
--   
ExplBidir :: [Clause] -> PatSynDir -- | A pattern synonym's argument type. data PatSynArgs -- |
--   pattern P {x y z} = p
--   
PrefixPatSyn :: [Name] -> PatSynArgs -- |
--   pattern {x P y} = p
--   
InfixPatSyn :: Name -> Name -> PatSynArgs -- |
--   pattern P { {x,y,z} } = p
--   
RecordPatSyn :: [Name] -> PatSynArgs data Exp -- |
--   { x }
--   
VarE :: Name -> Exp -- |
--   data T1 = C1 t1 t2; p = {C1} e1 e2
--   
ConE :: Name -> Exp -- |
--   { 5 or 'c'}
--   
LitE :: Lit -> Exp -- |
--   { f x }
--   
AppE :: Exp -> Exp -> Exp -- |
--   { f @Int }
--   
AppTypeE :: Exp -> Type -> Exp -- |
--   {x + y} or {(x+)} or {(+ x)} or {(+)}
--   
InfixE :: Maybe Exp -> Exp -> Maybe Exp -> Exp -- |
--   {x + y}
--   
-- -- See Language.Haskell.TH.Syntax#infix UInfixE :: Exp -> Exp -> Exp -> Exp -- |
--   { (e) }
--   
-- -- See Language.Haskell.TH.Syntax#infix ParensE :: Exp -> Exp -- |
--   { \ p1 p2 -> e }
--   
LamE :: [Pat] -> Exp -> Exp -- |
--   { \case m1; m2 }
--   
LamCaseE :: [Match] -> Exp -- |
--   { \cases m1; m2 }
--   
LamCasesE :: [Clause] -> Exp -- |
--   { (e1,e2) }
--   
-- -- The Maybe is necessary for handling tuple sections. -- --
--   (1,)
--   
-- -- translates to -- --
--   TupE [Just (LitE (IntegerL 1)),Nothing]
--   
TupE :: [Maybe Exp] -> Exp -- |
--   { (# e1,e2 #) }
--   
-- -- The Maybe is necessary for handling tuple sections. -- --
--   (# 'c', #)
--   
-- -- translates to -- --
--   UnboxedTupE [Just (LitE (CharL 'c')),Nothing]
--   
UnboxedTupE :: [Maybe Exp] -> Exp -- |
--   { (#|e|#) }
--   
UnboxedSumE :: Exp -> SumAlt -> SumArity -> Exp -- |
--   { if e1 then e2 else e3 }
--   
CondE :: Exp -> Exp -> Exp -> Exp -- |
--   { if | g1 -> e1 | g2 -> e2 }
--   
MultiIfE :: [(Guard, Exp)] -> Exp -- |
--   { let { x=e1; y=e2 } in e3 }
--   
LetE :: [Dec] -> Exp -> Exp -- |
--   { case e of m1; m2 }
--   
CaseE :: Exp -> [Match] -> Exp -- | { do { p <- e1; e2 } } or a qualified do if the module -- name is present DoE :: Maybe ModName -> [Stmt] -> Exp -- | { mdo { x <- e1 y; y <- e2 x; } } or a qualified mdo if -- the module name is present MDoE :: Maybe ModName -> [Stmt] -> Exp -- |
--   { [ (x,y) | x <- xs, y <- ys ] }
--   
-- -- The result expression of the comprehension is the last of the -- Stmts, and should be a NoBindS. -- -- E.g. translation: -- --
--   [ f x | x <- xs ]
--   
-- --
--   CompE [BindS (VarP x) (VarE xs), NoBindS (AppE (VarE f) (VarE x))]
--   
CompE :: [Stmt] -> Exp -- |
--   { [ 1 ,2 .. 10 ] }
--   
ArithSeqE :: Range -> Exp -- |
--   { [1,2,3] }
--   
ListE :: [Exp] -> Exp -- |
--   { e :: t }
--   
SigE :: Exp -> Type -> Exp -- |
--   { T { x = y, z = w } }
--   
RecConE :: Name -> [FieldExp] -> Exp -- |
--   { (f x) { z = w } }
--   
RecUpdE :: Exp -> [FieldExp] -> Exp -- |
--   { static e }
--   
StaticE :: Exp -> Exp -- |
--   { _x }
--   
-- -- This is used for holes or unresolved identifiers in AST quotes. Note -- that it could either have a variable name or constructor name. UnboundVarE :: Name -> Exp -- | { #x } ( Overloaded label ) LabelE :: String -> Exp -- | { ?x } ( Implicit parameter ) ImplicitParamVarE :: String -> Exp -- | { exp.field } ( Overloaded Record Dot ) GetFieldE :: Exp -> String -> Exp -- | (.x) or (.x.y) (Record projections) ProjectionE :: NonEmpty String -> Exp -- |
--   [|| e ||]
--   
TypedBracketE :: Exp -> Exp -- |
--   $$e
--   
TypedSpliceE :: Exp -> Exp -- |
--   { type t }
--   
TypeE :: Type -> Exp data Match -- |
--   case e of { pat -> body where decs }
--   
Match :: Pat -> Body -> [Dec] -> Match data Body -- |
--   f p { | e1 = e2
--         | e3 = e4 }
--    where ds
--   
GuardedB :: [(Guard, Exp)] -> Body -- |
--   f p { = e } where ds
--   
NormalB :: Exp -> Body data Guard -- |
--   f x { | odd x } = x
--   
NormalG :: Exp -> Guard -- |
--   f x { | Just y <- x, Just z <- y } = z
--   
PatG :: [Stmt] -> Guard data Stmt -- |
--   p <- e
--   
BindS :: Pat -> Exp -> Stmt -- |
--   { let { x=e1; y=e2 } }
--   
LetS :: [Dec] -> Stmt -- |
--   e
--   
NoBindS :: Exp -> Stmt -- | x <- e1 | s2, s3 | s4 (in CompE) ParS :: [[Stmt]] -> Stmt -- |
--   rec { s1; s2 }
--   
RecS :: [Stmt] -> Stmt data Range FromR :: Exp -> Range FromThenR :: Exp -> Exp -> Range FromToR :: Exp -> Exp -> Range FromThenToR :: Exp -> Exp -> Exp -> Range data Lit CharL :: Char -> Lit StringL :: String -> Lit -- | Used for overloaded and non-overloaded literals. We don't have a good -- way to represent non-overloaded literals at the moment. Maybe that -- doesn't matter? IntegerL :: Integer -> Lit RationalL :: Rational -> Lit IntPrimL :: Integer -> Lit WordPrimL :: Integer -> Lit FloatPrimL :: Rational -> Lit DoublePrimL :: Rational -> Lit -- | A primitive C-style string, type Addr# StringPrimL :: [Word8] -> Lit -- | Some raw bytes, type Addr#: BytesPrimL :: Bytes -> Lit CharPrimL :: Char -> Lit -- | Pattern in Haskell given in {} data Pat -- |
--   { 5 or 'c' }
--   
LitP :: Lit -> Pat -- |
--   { x }
--   
VarP :: Name -> Pat -- |
--   { (p1,p2) }
--   
TupP :: [Pat] -> Pat -- |
--   { (# p1,p2 #) }
--   
UnboxedTupP :: [Pat] -> Pat -- |
--   { (#|p|#) }
--   
UnboxedSumP :: Pat -> SumAlt -> SumArity -> Pat -- |
--   data T1 = C1 t1 t2; {C1 @ty1 p1 p2} = e
--   
ConP :: Name -> [Type] -> [Pat] -> Pat -- |
--   foo ({x :+ y}) = e
--   
InfixP :: Pat -> Name -> Pat -> Pat -- |
--   foo ({x :+ y}) = e
--   
-- -- See Language.Haskell.TH.Syntax#infix UInfixP :: Pat -> Name -> Pat -> Pat -- |
--   {(p)}
--   
-- -- See Language.Haskell.TH.Syntax#infix ParensP :: Pat -> Pat -- |
--   { ~p }
--   
TildeP :: Pat -> Pat -- |
--   { !p }
--   
BangP :: Pat -> Pat -- |
--   { x @ p }
--   
AsP :: Name -> Pat -> Pat -- |
--   { _ }
--   
WildP :: Pat -- |
--   f (Pt { pointx = x }) = g x
--   
RecP :: Name -> [FieldPat] -> Pat -- |
--   { [1,2,3] }
--   
ListP :: [Pat] -> Pat -- |
--   { p :: t }
--   
SigP :: Pat -> Type -> Pat -- |
--   { e -> p }
--   
ViewP :: Exp -> Pat -> Pat -- |
--   { type p }
--   
TypeP :: Type -> Pat -- | { p }@ InvisP :: Type -> Pat type FieldExp = (Name, Exp) type FieldPat = (Name, Pat) data Type -- |
--   forall <vars>. <ctxt> => <type>
--   
ForallT :: [TyVarBndr Specificity] -> Cxt -> Type -> Type -- |
--   forall <vars> -> <type>
--   
ForallVisT :: [TyVarBndr ()] -> Type -> Type -- |
--   T a b
--   
AppT :: Type -> Type -> Type -- |
--   T @k t
--   
AppKindT :: Type -> Kind -> Type -- |
--   t :: k
--   
SigT :: Type -> Kind -> Type -- |
--   a
--   
VarT :: Name -> Type -- |
--   T
--   
ConT :: Name -> Type -- |
--   'T
--   
PromotedT :: Name -> Type -- |
--   T + T
--   
InfixT :: Type -> Name -> Type -> Type -- |
--   T + T
--   
-- -- See Language.Haskell.TH.Syntax#infix UInfixT :: Type -> Name -> Type -> Type -- |
--   T :+: T
--   
PromotedInfixT :: Type -> Name -> Type -> Type -- |
--   T :+: T
--   
-- -- See Language.Haskell.TH.Syntax#infix PromotedUInfixT :: Type -> Name -> Type -> Type -- |
--   (T)
--   
ParensT :: Type -> Type -- | (,), (,,), etc. TupleT :: Int -> Type -- | (#,#), (#,,#), etc. UnboxedTupleT :: Int -> Type -- | (#|#), (#||#), etc. UnboxedSumT :: SumArity -> Type -- |
--   ->
--   
ArrowT :: Type -- |
--   %n ->
--   
-- -- Generalised arrow type with multiplicity argument MulArrowT :: Type -- |
--   ~
--   
EqualityT :: Type -- |
--   []
--   
ListT :: Type -- | '(), '(,), '(,,), etc. PromotedTupleT :: Int -> Type -- |
--   '[]
--   
PromotedNilT :: Type -- |
--   '(:)
--   
PromotedConsT :: Type -- |
--   *
--   
StarT :: Type -- |
--   Constraint
--   
ConstraintT :: Type -- | 0, 1, 2, etc. LitT :: TyLit -> Type -- |
--   _
--   
WildCardT :: Type -- |
--   ?x :: t
--   
ImplicitParamT :: String -> Type -> Type -- | The flag type parameter is instantiated to one of the -- following types: -- -- data TyVarBndr flag -- |
--   a
--   
PlainTV :: Name -> flag -> TyVarBndr flag -- |
--   (a :: k)
--   
KindedTV :: Name -> flag -> Kind -> TyVarBndr flag data TyLit -- |
--   2
--   
NumTyLit :: Integer -> TyLit -- |
--   "Hello"
--   
StrTyLit :: String -> TyLit -- | 'C', @since 4.16.0.0 CharTyLit :: Char -> TyLit -- | To avoid duplication between kinds and types, they are defined to be -- the same. Naturally, you would never have a type be StarT and -- you would never have a kind be SigT, but many of the other -- constructors are shared. Note that the kind Bool is denoted -- with ConT, not PromotedT. Similarly, tuple kinds are -- made with TupleT, not PromotedTupleT. type Kind = Type type Cxt = [Pred] -- | Since the advent of ConstraintKinds, constraints are really -- just types. Equality constraints use the EqualityT constructor. -- Constraints may also be tuples of other constraints. type Pred = Type -- | Role annotations data Role -- |
--   nominal
--   
NominalR :: Role -- |
--   representational
--   
RepresentationalR :: Role -- |
--   phantom
--   
PhantomR :: Role -- |
--   _
--   
InferR :: Role data Specificity -- |
--   a
--   
SpecifiedSpec :: Specificity -- |
--   {a}
--   
InferredSpec :: Specificity data BndrVis -- |
--   a
--   
BndrReq :: BndrVis -- |
--   @a
--   
BndrInvis :: BndrVis -- | Type family result signature data FamilyResultSig -- | no signature NoSig :: FamilyResultSig -- |
--   k
--   
KindSig :: Kind -> FamilyResultSig -- |
--   = r, = (r :: k)
--   
TyVarSig :: TyVarBndr () -> FamilyResultSig -- | Injectivity annotation data InjectivityAnn InjectivityAnn :: Name -> [Name] -> InjectivityAnn -- | A pattern synonym's type. Note that a pattern synonym's fully -- specified type has a peculiar shape coming with two forall quantifiers -- and two constraint contexts. For example, consider the pattern synonym -- --
--   pattern P x1 x2 ... xn = <some-pattern>
--   
-- -- P's complete type is of the following form -- --
--   pattern P :: forall universals.   required constraints
--             => forall existentials. provided constraints
--             => t1 -> t2 -> ... -> tn -> t
--   
-- -- consisting of four parts: -- --
    --
  1. the (possibly empty lists of) universally quantified type -- variables and required constraints on them.
  2. --
  3. the (possibly empty lists of) existentially quantified type -- variables and the provided constraints on them.
  4. --
  5. the types t1, t2, .., tn of -- x1, x2, .., xn, respectively
  6. --
  7. the type t of <some-pattern>, mentioning -- only universals.
  8. --
-- -- Pattern synonym types interact with TH when (a) reifying a pattern -- synonym, (b) pretty printing, or (c) specifying a pattern synonym's -- type signature explicitly: -- -- -- -- See the GHC user's guide for more information on pattern synonyms and -- their types: -- https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#pattern-synonyms. type PatSynType = Type type BangType = (Bang, Type) type VarBangType = (Name, Bang, Type) -- | Add Haddock documentation to the specified location. This will -- overwrite any documentation at the location if it already exists. This -- will reify the specified name, so it must be in scope when you call -- it. If you want to add documentation to something that you are -- currently splicing, you can use addModFinalizer e.g. -- --
--   do
--     let nm = mkName "x"
--     addModFinalizer $ putDoc (DeclDoc nm) "Hello"
--     [d| $(varP nm) = 42 |]
--   
-- -- The helper functions withDecDoc and withDecsDoc will -- do this for you, as will the funD_doc and other _doc -- combinators. You most likely want to have the -haddock flag -- turned on when using this. Adding documentation to anything outside of -- the current module will cause an error. putDoc :: DocLoc -> String -> Q () -- | Retrieves the Haddock documentation at the specified location, if one -- exists. It can be used to read documentation on things defined outside -- of the current module, provided that those modules were compiled with -- the -haddock flag. getDoc :: DocLoc -> Q (Maybe String) -- | A location at which to attach Haddock documentation. Note that adding -- documentation to a Name defined oustide of the current module -- will cause an error. data DocLoc -- | At the current module's header. ModuleDoc :: DocLoc -- | At a declaration, not necessarily top level. DeclDoc :: Name -> DocLoc -- | At a specific argument of a function, indexed by its position. ArgDoc :: Name -> Int -> DocLoc -- | At a class or family instance. InstDoc :: Type -> DocLoc class Ppr a ppr :: Ppr a => a -> Doc ppr_list :: Ppr a => [a] -> Doc pprint :: Ppr a => a -> String pprExp :: Precedence -> Exp -> Doc pprLit :: Precedence -> Lit -> Doc pprPat :: Precedence -> Pat -> Doc pprParendType :: Type -> Doc