From a720322f417547f85ae22b1930721e8cab8de281 Mon Sep 17 00:00:00 2001 From: romes Date: Sat, 19 Mar 2022 12:06:36 +0000 Subject: Restore Note [Quasi-quote overview] --- compiler/Language/Haskell/Syntax/Expr.hs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'compiler/Language/Haskell/Syntax') diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs index 6491f525fa..dde9775dd8 100644 --- a/compiler/Language/Haskell/Syntax/Expr.hs +++ b/compiler/Language/Haskell/Syntax/Expr.hs @@ -1533,6 +1533,25 @@ that we can pretty-print it correctly. ************************************************************************ -} +{- +Note [Quasi-quote overview] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The "quasi-quote" extension is described by Geoff Mainland's paper +"Why it's nice to be quoted: quasiquoting for Haskell" (Haskell +Workshop 2007). + +Briefly, one writes + [p| stuff |] +and the arbitrary string "stuff" gets parsed by the parser 'p', whose +type should be Language.Haskell.TH.Quote.QuasiQuoter. 'p' must be +defined in another module, because we are going to run it here. It's +a bit like a TH splice: + $(p "stuff") + +However, you can do this in patterns as well as terms. Because of this, +the splice is run by the *renamer* rather than the type checker. +-} + -- | Haskell Splice data HsSplice id = HsTypedSplice -- $$z or $$(f 4) @@ -1547,7 +1566,7 @@ data HsSplice id (IdP id) -- A unique name to identify this splice point (LHsExpr id) -- See Note [Pending Splices] - | HsQuasiQuote -- See Note [Quasi-quote overview] in GHC.Tc.Gen.Splice + | HsQuasiQuote -- See Note [Quasi-quote overview] (XQuasiQuote id) (IdP id) -- Splice point (IdP id) -- Quoter -- cgit v1.2.1