Language.Haskell.TH.Quote
| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Contents
Description
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.
data QuasiQuoter
Constructors
| QuasiQuoter | |
quoteFile :: QuasiQuoter -> QuasiQuoter Source
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
For backwards compatibility
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 :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Exp)) -> a -> m Exp
dataToPatQ :: (Quote m, Data a) => (forall b. Data b => b -> Maybe (m Pat)) -> a -> m Pat
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/template-haskell-2.23.0.0-22c1/Language-Haskell-TH-Quote.html