<div dir="ltr">One potential difference between the two is that the current behavior allows the `Main` module to import `main` from another module, while the new behavior would fail in that case.<div><br></div><div>For example, a file that has only a single line:</div><div><br></div><div> import SomeOtherModule(main)</div><div><br></div><div>This still seems like a fairly unusual corner case (with an obvious work around), so I don't think it matters much, but I thought I'd mention it so that we are aware of it.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 16, 2017 at 7:18 AM, Joachim Breitner <span dir="ltr"><<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
a very small proposal to be considered for Haskell':<br>
<br>
Currently, the report states<br>
<br>
An abbreviated form of module, consisting only of the module body,<br>
is permitted. If this is used, the header is assumed to be ‘module<br>
Main(main) where’.<br>
<br>
I propose to change that to<br>
<br>
An abbreviated form of module, consisting only of the module body,<br>
is permitted. If this is used, the header is assumed to be ‘module<br>
Main where’.<br>
<br>
The rationale is that a main-less main module is still useful, e.g.<br>
when you are working a lot in GHCi, and offload a few extensions to a<br>
separate file. Currently, tools like hdevtools will complain about a<br>
missing main function when editing such a file.<br>
<br>
It would also work better with GHC’s -main-is flag, and avoid problems<br>
like the one described in <a href="https://ghc.haskell.org/trac/ghc/ticket/13704" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/<wbr>ghc/ticket/13704</a><br>
<br>
<br>
I don’t see any downsides. When compiling to a binary, implementations<br>
are still able to detect that a Main module is not imported by any<br>
other module and only the main function is used, and optimize as if<br>
only main were exported.<br>
<br>
Greetings,<br>
Joachim<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Joachim “nomeata” Breitner<br>
<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a> • <a href="https://www.joachim-breitner.de/" rel="noreferrer" target="_blank">https://www.joachim-breitner.<wbr>de/</a><br>
XMPP: <a href="mailto:nomeata@joachim-breitner.de">nomeata@joachim-breitner.de</a> • OpenPGP-Key: 0xF0FBF51F<br>
Debian Developer: <a href="mailto:nomeata@debian.org">nomeata@debian.org</a></font></span><br>______________________________<wbr>_________________<br>
Haskell-prime mailing list<br>
<a href="mailto:Haskell-prime@haskell.org">Haskell-prime@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>prime</a><br>
<br></blockquote></div><br></div>