On Tue, 2007-11-13 at 16:24 +0100, David Waern wrote:

> Well, Haddock comments can refer to Haskell identifiers. So when the
> contents of a Haddock comment has been parsed, the result can contain
> 'RdrName's which is GHC-lingo for an identifier with a yet-unidentified
> original definition site. These identifiers need to be renamed by the
> renamer phase in GHC just like any other identifier.
> 
> So if we are going to store opaque Haddock comments in the AST (either
> using strings or with Dynamic) we need to solve this renaming problem
> somehow. Simon suggested an idea where we pass in a function to GHC that
> parses and renames the Haddock comments.

Why not the other way around. haddock could use functions from the GHC
API to ask the renamer to resolve a bunch of names.

So in this hypothetical system, haddock uses the GHC API to get at the
comments in the AST, it somehow figures out which comments are in
locations that are legal for haddock markup, parses them. It extracts
the names from the markup and using the GHC API again (stuff from the
renamer) tries to resolve them to original definitions.

I'm not sure it makes sense to be resolving names during the early
renaming phase anyway since haddock markup often refers to names which
are not imported directly. It might make better sense to keep RdrNames
and resolve them much later with access to all the exported names in a
package, not merely the subset imported in the current module.

Duncan

_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to