Hello, actually, the bug here is that `f` is exported, as omitting the export list is not equivalent to writing `module A` in the export list.
This is explicitly stated in Section 5.2 of the Haskell report: "If the export list is omitted, all values, types and classes defined in the module are exported, but not those that are imported." -Iavor On Thu, May 11, 2017 at 1:23 PM, Simon Peyton Jones via Glasgow-haskell-users <glasgow-haskell-users@haskell.org> wrote: > | Is there a reason GHC considers this case an unused import? It seems that > | the use of the import is explicitly stated right within the import > | itself. Should I submit a ticket for this? > > Hmm. I think you are saying that > > module A where > import B as A(f) > g = True > > that is equivalent to > module A( module A ) where ... > > which exports all things "x" in scope as "A.x". So it'll export both f > and g. > > But GHC will report f as unused, but not g. And that's inconsistent. Fair > point. Yes, file a ticket. Better still, offer a patch :-). > > Simon > > | -----Original Message----- > | From: Glasgow-haskell-users [mailto:glasgow-haskell-users- > | boun...@haskell.org] On Behalf Of Yitzchak Gale > | Sent: 10 May 2017 13:56 > | To: GHC users <glasgow-haskell-users@haskell.org> > | Subject: Unused import warning on re-export > | > | I have a module A with no export list, and a function f which from the > | API point of view should part of the export list of A. But f must be > | defined in module B, not module A, due an import cycle. I added this line > | in module A to re-export f from A: > | > | import B as A (f) > | > | This resulted in an unused import warning. That is a problem for us - we > | keep our large code base clean of warnings as a policy. > | > | Is there a reason GHC considers this case an unused import? It seems that > | the use of the import is explicitly stated right within the import > | itself. Should I submit a ticket for this? > | > | Thanks, > | Yitz > | _______________________________________________ > | Glasgow-haskell-users mailing list > | Glasgow-haskell-users@haskell.org > | https://na01.safelinks.protection.outlook.com/?url= > http%3A%2F%2Fmail.hask > | ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell- > | users&data=02%7C01%7Csimonpj%40microsoft.com% > 7C81b06c9737d540a597df08d497 > | a413d0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0% > 7C636300178355700119&sd > | ata=xHt1FXEF5r4WMaMF3FSW4jFBRlB4OK8DQdcNAxZ7HOc%3D&reserved=0 > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users >
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users