HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduletemplate-haskell-quasiquoter-0.1.0.0Haskell2010

Language.Haskell.TH.QuasiQuoter

  • 6 types
  • 2 values
datadata QuasiQuoter
#

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.

This is exposed both from the template-haskell-quasiquoter and template-haskell packages. Consider importing it from the more stable template-haskell-quasiquoter if you don't need the full breadth of the template-haskell interface.

Constructors

A QuasiQuoter that fails with a helpful error message in every context. It is intended to be modified to create a QuasiQuoter that fails in all inappropriate contexts.

For example, you could write

myPatQQ = (namedDefaultQuasiQuoter "myPatQQ")
  { quotePat = ... }

If myPatQQ is used in an expression context, the compiler will report that, naming myPatQQ.

See also defaultQuasiQuoter, which does not name the QuasiQuoter in the error message, and might therefore be more appropriate when the users of a particular QuasiQuoter tend to define local "synonyms" for it.

newtypenewtype Q a
#

In short, Q provides the Quasi operations in one neat monad for the user.

The longer story, is that Q wraps an arbitrary Quasi-able monad. The perceptive reader notices that Quasi has only two instances, Q itself and IO, neither of which have concrete implementations.Q plays the trick of dependency inversion, providing an abstract interface for the user which is later concretely fufilled by an concrete Quasi instance, internal to GHC.

Instances10Monad, Functor, MonadFix, MonadFail, Applicative, Quote, …
  • Monad QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Functor QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • MonadFix QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax

    If the function passed to mfix inspects its argument, the resulting action will throw a FixIOException.

  • MonadFail QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Applicative QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Quote QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • MonadIO QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Quasi QDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Semigroup a => Semigroup (Q a)Defined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
  • Monoid a => Monoid (Q a)Defined in ghc-internal-9.1401.0 · GHC.Internal.TH.Syntax
datadata Exp
#

A Haskell expression.

Instances7Eq, Data, Ord, Show, Generic, Lift, …
datadata Pat
#

Pattern in Haskell given in {}

Instances7Eq, Data, Ord, Show, Generic, Lift, …
datadata Type
#

A Haskell type.

Instances7Eq, Data, Ord, Show, Generic, Lift, …
datadata Dec
#

A single declaration.

Instances7Eq, Data, Ord, Show, Generic, Lift, …