Exported modules in the GHC API
david.waern at gmail.com
Mon May 23 14:52:31 CEST 2011
2011/5/23 Simon Marlow <marlowsd at gmail.com>:
> This is the way it's defined in Haskell - a 'module' export expands to all
> those names in scope qualified with that module name. There might be
> several different modules imported with that name, and the 'module' export
> would export the contents of all of them. So I'm afraid you have to
> traverse the whole of the scope.
Aha. I suspected I didn't know the full story. Thanks for claring it up.
> I suspect we don't do this properly in Haddock, since the documentation
> always contains just a link to the exported module, right?
Yes, it contains a link if the exported module is not hidden,
otherwise we inline all the export items of the module. There are
several things related to module exports that we do wrong currently.
So I propose we should do this:
There are two different behaviours:
1) We emit a link (under the original module name), if:
* The module name is used to fully import exactly one non-hidden module.
2) We inline all imported export items from the module(s), if:
* The module name is used by imports from more than one module
or (one module):
* The module name points to a hidden module
* The module name points to a partially-imported module
Sounds OK? That would fix #174 as well as handle multiple modules
imported under the same name.
More information about the Glasgow-haskell-users