Skip to content
  • Simon Peyton Jones's avatar
    Add quasi-quotation, courtesy of Geoffrey Mainland · f3399c44
    Simon Peyton Jones authored
    This patch adds quasi-quotation, as described in
      "Nice to be Quoted: Quasiquoting for Haskell"
    	(Geoffrey Mainland, Haskell Workshop 2007)
    Implemented by Geoffrey and polished by Simon.
    
    Overview
    ~~~~~~~~
    The syntax for quasiquotation is very similar to the existing
    Template haskell syntax:
    	[$q| stuff |]
    where 'q' is the "quoter".  This syntax differs from the paper, by using
    a '$' rather than ':', to avoid clashing with parallel array comprehensions.
     
    The "quoter" is a value of type Language.Haskell.TH.Quote.QuasiQuoter, which
    contains two functions for quoting expressions and patterns, respectively.
     
         quote = Language.Haskell.TH.Quote.QuasiQuoter quoteExp quotePat
     
         quoteExp :: String -> Language.Haskell.TH.ExpQ
         quotePat :: String -> Language.Haskell.TH.PatQ
    
    TEXT is passed unmodified to the quoter. The context of the
    quasiquotation statement determines which of the two quoters is
    called: if the quasiquotation occurs in an expression ...
    f3399c44