diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-03-19 12:06:36 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-06-01 07:44:44 -0400 |
commit | a720322f417547f85ae22b1930721e8cab8de281 (patch) | |
tree | 1d2dc4c042e14b800e09c472cffc5f6d75473355 /compiler/Language | |
parent | d4c71f098f82b61b3dc1f056e0518c973fa51b68 (diff) | |
download | haskell-a720322f417547f85ae22b1930721e8cab8de281.tar.gz |
Restore Note [Quasi-quote overview]
Diffstat (limited to 'compiler/Language')
-rw-r--r-- | compiler/Language/Haskell/Syntax/Expr.hs | 21 |
1 files changed, 20 insertions, 1 deletions
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 |