Skip to content

Expose the source location of template-haskell Names

I've often wanted to know where a particular Name is defined (specifically the filepath), but as far as I can tell, template-haskell doesn't currently support this. It'd be really nice to have a function

nameLoc :: Name -> Loc

to expose the definition site of the Name.

I think this should be fairly straightforward to add since GHC carries the definition site around with its Names, but I've never looked at the TH internals.

Trac metadata
Trac field Value
Version 7.11
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information