
On Wed, Apr 3, 2013 at 5:42 PM, Manuel M T Chakravarty
Simon's point is that GHC can print names in different ways. The verbosity of a printed name depends on the context in which it is printed (and -dppr-debug is a way to tell GHC that you want to get all info, including uniques etc).
I understand that. I think it's unrelated to my problem however. moduleName_maybe, the function that's supposed to give me the module of a Name returns Nothing for all locally defined names. My guess is that these Names aren't made fully qualified until some later stage.
I'm not sure what your 'invertedIndex' does. You seem to use the 'Show' instance via 'print'. However, I don't think 'Name' has a 'Show' instance. So, I wonder how you convert the 'Name's to 'String's.
invertedIndex isn't interesting in this case. Briefly, it takes a Bag of Names created by the 'symbols' function and build an inverted index (a search engine term) from the names. I derived Show instances for all GHC types for debugging.
In GHC, we do the following, use 'ppr' to convert an entity to an 'SDoc' and then when the 'SDoc' gets turned into a 'String', the dynamic flags determine what detail of a 'Name' to print. You can do this in one step with 'showPpr' http://www.haskell.org/ghc/docs/latest/html/libraries/ghc-7.6.2/Outputable.h..., but you need to supply some 'DynFlags' http://www.haskell.org/ghc/docs/latest/html/libraries/ghc-7.6.2/DynFlags.htm....