#1803: Include qCurrentLoc in the  Quasi class
-------------------------------+--------------------------------------------
  Reporter:  guest             |          Owner:                  
      Type:  feature request   |         Status:  closed          
  Priority:  normal            |      Milestone:  _|_             
 Component:  Template Haskell  |        Version:  6.6.1           
Resolution:  fixed             |       Keywords:                  
  Testcase:                    |      Blockedby:                  
Difficulty:  Unknown           |             Os:  Unknown/Multiple
  Blocking:                    |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |  
-------------------------------+--------------------------------------------
Changes (by reinerp):

  * status:  new => closed
  * failure:  => None/Unknown
  * resolution:  => fixed


Comment:

 This was implemented when quasi-quotation was introduced:

 {{{
 commit 3202618f6aefdd0921b4e8e94754cef7ddda720f
 Author: [email protected] <unknown>
 Date:   Fri Jan 18 15:10:16 2008 +0000

     Support code for quasi-quotation feature

     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  [email protected]
         * 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.

 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1803#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to