Changes between Version 70 and Version 71 of ExplicitCallStack


Ignore:
Timestamp:
Apr 21, 2008 8:27:53 AM (6 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExplicitCallStack

    v70 v71  
    1212== The basic idea ==  
    1313 
    14 1.  GHC's 'assert' magically injects the current file location.  One could imagine generalising this a bit so that you could say 
     141.  GHC's 'assert' magically injects the current file location.  But Template Haskell already allows you do to this rather nicely: 
    1515{{{ 
    1616        ...(f $currentLocation)... 
    1717}}} 
    18 to pass a string describing the current location to f. 
     18where 
     19{{{ 
     20  currentLocation :: Q Exp 
     21  currentLocation = do { loc <- qLocation 
     22                       ; return [| loc |] } 
     23}}} 
     24This doesn't quite work today because `loc` has type `Language.Haskell.TH.Syntax.Loc`, a record of location information, and that isn't an instance of `Lift` (yet).  But the idea is basically fine: TH gives you access to the current source location. 
    1925 
    20262.  But that doesn't help with 'head'.  We want to pass head's ''call site'' to head. That's what jhc does when you give 'head' the a magic [http://repetae.net/john/computer/jhc/jhc.html SRCLOC_ANNOTATE pragma]: