Exported modules in the GHC API

Simon Marlow marlowsd at gmail.com
Fri May 27 11:21:04 CEST 2011

On 23/05/2011 13:52, David Waern wrote:
> 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.

Fully *export*, you mean?

> 2) We inline all imported export items from the module(s), if:

(2) applies in all the cases that (1) doesn't, right?  We can list those 
cases, but the code doesn't need to check for them explicitly, checking 
the condition for (1) is enough.

 >    * 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 mailing list