<div dir="ltr">Actually, I just tried to make an example of this, and GHC does not seem to export `f`, just as the report says.  So I'd say GHC is behaving correctly, both with the exports and the warning.<div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 12, 2017 at 10:39 AM, Iavor Diatchki <span dir="ltr"><<a href="mailto:iavor.diatchki@gmail.com" target="_blank">iavor.diatchki@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Iavor</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></font></span></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><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@<wbr>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>| 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><br>
| -----Original Message-----<br>
| From: Glasgow-haskell-users [mailto:<a href="mailto:glasgow-haskell-users-" target="_blank">glasgow-haskell-users-</a><br>
| <a href="mailto:bounces@haskell.org" target="_blank">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" target="_blank">glasgow-haskell-users@haskell<wbr>.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" target="_blank">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.protect<wbr>ion.outlook.com/?url=http%3A%<wbr>2F%2Fmail.hask</a><br>
| <a href="http://ell.org" rel="noreferrer" target="_blank">ell.org</a>%2Fcgi-bin%2Fmailman%2F<wbr>listinfo%2Fglasgow-haskell-<br>
| users&data=02%7C01%7Csimonpj%<a href="http://40microsoft.com" rel="noreferrer" target="_blank">4<wbr>0microsoft.com</a>%7C81b06c9737d54<wbr>0a597df08d497<br>
| a413d0%7C72f988bf86f141af91ab2<wbr>d7cd011db47%7C1%7C0%7C63630017<wbr>8355700119&sd<br>
| ata=xHt1FXEF5r4WMaMF3FSW4jFBRl<wbr>B4OK8DQdcNAxZ7HOc%3D&reserved=<wbr>0<br>
<div class="m_-724092696157402427HOEnZb"><div class="m_-724092696157402427h5">______________________________<wbr>_________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">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-bi<wbr>n/mailman/listinfo/glasgow-has<wbr>kell-users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>