| i'm currently using
|
|   moduleNameString . moduleName . nameModule . getName

Yes, that tells you the module that *defined* the thing.  See
http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/NameType

You want to know how the thing was brought into this lexical scope, so you need 
to consult the current GlobalRdrEnv. See

http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Renamer



To do what you want:
* Get the OccName of the thing
* Look that up in the GlobalRdrEnv, to get a [GlobalRdrElt]
* Of these, at most one will have gre_name == the Name of the thing
* Look at the gre_prov for that GRE

The provenance tells you how it is in scope (perhaps in multiple ways).


Does that help?

The commentary is obviously deficient; could you spend a few mins updating it 
so that you'd have been able to find this info more easily?

Thanks

Simon

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to