Using the GHC API: pretty printing with qualified names

JP Moresmau jpmoresmau at
Wed Nov 17 14:21:11 EST 2010

Hello, I'm the maintainer for EclipseFP, which involves using the scion
library and the GHC API to provide IDE functionality. I have a little issue
that no doubt stems from me not understanding the GHC API well, and I would
be grateful for any light on the matter.
I'm trying to give the user the possibility to jump to the definition of a
symbol in the source file. You click on the name of a function and you're
send to the module where it's defined. So I have an AST, and somewhere down
the line I have an Id object representing that function call. Then I just
use ppr alwaysQualify id to get the fully qualified name of the function,
and I can then use the module name to retrieve the source file etc. This
works well in cases, but not in others. It will sound silly to the gurus on
the list, but it's when the function has generics that it doesn't work. So a
function with a type class in its type signature will never be printed
qualified. It kinda like makes sense because I suppose some work has been
done so that it represents the function with proper types, etc., but how can
I get back to the original Id? How can I get back from that unqualified Id
to the qualified Id representing the function in the original module? I've
been looking round Name and OccName and all that but I'm not sure really
what I'm looking for.

Hope I'm making sense!!


JP Moresmau
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list