<div dir="ltr">Hello,<div><br></div><div>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.</div><div><br></div><div>This is explicitly stated in Section 5.2 of the Haskell report:</div><div><br></div><div><div> "If the export list is omitted, all values, types and classes defined in the module are exported, but not those that are imported."</div><div><br></div><div>-Iavor</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 11, 2017 at 1:23 PM, Simon Peyton Jones via Glasgow-haskell-users <span dir="ltr"><<a href="mailto:glasgow-haskell-users@haskell.org" target="_blank">glasgow-haskell-users@haskell.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">| Is there a reason GHC considers this case an unused import? It seems that<br>
| the use of the import is explicitly stated right within the import<br>
| itself. Should I submit a ticket for this?<br>
<br>
</span>Hmm. I think you are saying that<br>
<br>
module A where<br>
import B as A(f)<br>
g = True<br>
<br>
that is equivalent to<br>
module A( module A ) where ...<br>
<br>
which exports all things "x" in scope as "A.x". So it'll export both f and g.<br>
<br>
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 :-).<br>
<br>
Simon<br>
<span class=""><br>
| -----Original Message-----<br>
| From: Glasgow-haskell-users [mailto:<a href="mailto:glasgow-haskell-users-">glasgow-haskell-users-</a><br>
| <a href="mailto:bounces@haskell.org">bounces@haskell.org</a>] On Behalf Of Yitzchak Gale<br>
| Sent: 10 May 2017 13:56<br>
| To: GHC users <<a href="mailto:glasgow-haskell-users@haskell.org">glasgow-haskell-users@<wbr>haskell.org</a>><br>
| Subject: Unused import warning on re-export<br>
|<br>
| I have a module A with no export list, and a function f which from the<br>
| API point of view should part of the export list of A. But f must be<br>
| defined in module B, not module A, due an import cycle. I added this line<br>
| in module A to re-export f from A:<br>
|<br>
| import B as A (f)<br>
|<br>
| This resulted in an unused import warning. That is a problem for us - we<br>
| keep our large code base clean of warnings as a policy.<br>
|<br>
| Is there a reason GHC considers this case an unused import? It seems that<br>
| the use of the import is explicitly stated right within the import<br>
| itself. Should I submit a ticket for this?<br>
|<br>
| Thanks,<br>
| Yitz<br>
| ______________________________<wbr>_________________<br>
| Glasgow-haskell-users mailing list<br>
| <a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.<wbr>org</a><br>
</span>| <a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask" rel="noreferrer" target="_blank">https://na01.safelinks.<wbr>protection.outlook.com/?url=<wbr>http%3A%2F%2Fmail.hask</a><br>
| <a href="http://ell.org" rel="noreferrer" target="_blank">ell.org</a>%2Fcgi-bin%2Fmailman%<wbr>2Flistinfo%2Fglasgow-haskell-<br>
| users&data=02%7C01%7Csimonpj%<a href="http://40microsoft.com" rel="noreferrer" target="_blank">4<wbr>0microsoft.com</a>%<wbr>7C81b06c9737d540a597df08d497<br>
| a413d0%<wbr>7C72f988bf86f141af91ab2d7cd011<wbr>db47%7C1%7C0%<wbr>7C636300178355700119&sd<br>
| ata=<wbr>xHt1FXEF5r4WMaMF3FSW4jFBRlB4OK<wbr>8DQdcNAxZ7HOc%3D&reserved=0<br>
<div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.<wbr>org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/glasgow-<wbr>haskell-users</a><br>
</div></div></blockquote></div><br></div>