How to disable warning for "export item 'module ...' exports nothing"?

Sean Leather leather at cs.uu.nl
Thu Aug 14 13:47:55 EDT 2008


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

Ah, got it. Thanks. I didn't realize instances of an imported module were
also implicitly exported.

I should have looked at the report, however. For the future reference of
others:

"Instance declarations cannot be explicitly named on import or export lists.
All instances in scope within a module are *always *exported and any import
brings *all* instances in from the imported module. Thus, an instance
declaration is in scope if and only if a chain of import declarations leads
to the module containing the instance declaration."
-- 5.4  Importing and Exporting Instance Declarations at
http://www.haskell.org/onlinereport/modules.html

It would definitely be nice to have a bit more control over
importing/exporting instances. I noticed this idea has been discussed a few
times already.

Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20080814/8dc0965c/attachment-0001.htm


More information about the Glasgow-haskell-users mailing list