[GHC] #9946: Expose the source location of template-haskell Names
GHC
ghc-devs at haskell.org
Tue Jan 6 22:42:42 UTC 2015
#9946: Expose the source location of template-haskell Names
-------------------------------------+-------------------------------------
Reporter: gridaphobe | Owner:
Type: feature request | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by simonpj):
An example is good, and I encouraged you to start with examples. But
ultimately we need a complete specification that says what happens for
every `Name`.
There are lots of ways to generate a `Name` in TH, and you only give one.
How about
{{{
f :: Q Exp -> Q Exp
f qe = do { Var x <- qe
; print (nameLoc x)
; [| blah |] }
}}}
For example I might call f with `f [| x |]`, or `f [| \x -> x |]`.
Or you can use `newName` or `mkName` to create a `Name`.
What locations would they have?
Look at `data Name` and `NameFlavour` in `Language.Haskell.TH`. I guess
that you ''might'' reasonably expect a location for a `NameG` and perhaps
a `NameL`. But it's not clear that `nameLoc :: Name -> Maybe SrcLoc` will
be useful to you.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9946#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list