How to disable warning for "export item 'module ...' exports
nothing"?
Ross Paterson
ross at soi.city.ac.uk
Fri Aug 15 07:36:41 EDT 2008
On Thu, Aug 14, 2008 at 08:00:25PM +0200, Sean Leather wrote:
> 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.
That shouldn't be necessary. Because instances are implicitly exported
and imported, you'll really want to avoid orphan instances, so that the
user can be sure that if both the class and the data type are in scope,
so is the instance. But then the instance will be listed under both
the class and the type in the Haddock documentation. It won't matter
where the instance was defined, just as it doesn't matter where other
stuff is defined, just where it is in scope.
Unfortunately Haddock does not allow doc comments to be attached to
instances, but that's independent of whether the defining module is shown.
More information about the Glasgow-haskell-users
mailing list