Haddocking exported instances [was Re: How to disable warning for "export item 'module ...' exports nothing"?]

Isaac Dupree isaacdupree at charter.net
Fri Aug 15 07:04:43 EDT 2008

Sean Leather wrote:
>> I have a module A that re-exports module B, and module B contains only
>>> class
>>> instances. Since I'm using -Wall, I get this warning about module B
>>> exporting nothing. Is there a way to disable this particular warning,
>>> since
>>> it is unnecessary in this case? No mailing list messages or GHC
>>> documentation has told me what to do.
>> Well, the warning is right that you don't need to re-export module B:
>> instances are implicitly exported.  So you could just remove the export of
>> "module B", unless there's a reason to export it (such as, you might add
>> some exported functions or data types to it later)
> Hmm, the disappointing result of removing module B from the export list is
> that now it doesn't show up in the Haddock-generated documentation for
> module A. Not that there was anything specific in B to document, because
> it's only instances. But I do want the user to know that importing A also
> imports B. Sigh... I suppose there's CPP if I really want it.

You could put a link to the module in the 
intro-documentation that comes before the export list, 
possibly in a sentence saying e.g. "deliberately exports 
instances from @module B@" (except I've forgotten Haddock 
syntax and might have used it wrong there :-)

It's an interesting use-case though.  I wonder if Haddock 
should automatically provide links to all instances exported 
from the module that are either (1) instances for datatypes 
or classes exported by the module, or (2) orphan (i.e. not 
defined in the same module as either the class or the 
datatype).  (It would be too tedious to list *all* exported 
instances, but luckily it's not necessary for completeness.)


More information about the Glasgow-haskell-users mailing list