Skip to content
  • Simon Peyton Jones's avatar
    Support code for quasi-quotation feature · 164d14e1
    Simon Peyton Jones authored
    This patch supports the quasi-quotation feature.  Here's the relevant
    parts from the message in the big compiler patch:
    
      Fri Jan 18 14:55:03 GMT 2008  simonpj@microsoft.com
        * Add quasi-quotation, courtesy of Geoffrey Mainland
      
      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.
    
    ...snip...
      
      * There is an accompanying patch to the template-haskell library. This
        involves one interface change:
      	currentModule :: Q String
        is replaced by
      	location :: Q Loc
        where Loc is a data type defined in TH.Syntax thus:
            data Loc
              = Loc { loc_filename :: String
      	      , loc_package  :: String
      	      , loc_module   :: String
      	      , loc_start    :: CharPos
      	      , loc_end      :: CharPos }
      
            type CharPos = (Int, Int)	-- Line and character position
       
        So you get a lot more info from 'location' than from 'currentModule'.
        The location you get is the location of the splice.
        
        This works in Template Haskell too of course, and lets a TH program
        generate much better error messages.
      
      * There's also a new module in the template-haskell package called 
        Language.Haskell.TH.Quote, which contains support code for the
        quasi-quoting feature.
    
    164d14e1