Duncan wrote:

> 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.

Yes, that should be possible if Haddock uses the GHC API to typecheck the
module (which it currently does). I guess then the environment used during
the renaming phased simply could be re-used. And if we in the future don't
do type checking in Haddock but instead rely on the .hi files of GHC, then
perhaps we could use the exported names to build a renaming environment.

> 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.

That's a very good point.

David


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

Reply via email to