[GHC] #8220: Macros / functions for source location
GHC
ghc-devs at haskell.org
Wed Sep 4 09:04:44 CEST 2013
#8220: Macros / functions for source location
-------------------------------------+------------------------------------
Reporter: wojteknar | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by simonpj):
Also in Template Haskell you can get the source location of the splice.
Thus
{{{
...$(do { loc <- location; ... })....
}}}
But not (currently) the name of the enclosing function. It's not obvious
exactly what you need here. The innermost enclosing function? Outermost?
What if the splice is in a type declaration not a value declaration?
In general, TH (rather than CPP) seems a nicer place to experiment. You
could work on a design in collaboration with others, with worked-out use-
cases.
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8220#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list