Default module header `module Main where`

Mario Blažević mblazevic at stilo.com
Fri May 19 21:35:24 UTC 2017


On 2017-05-16 10:18 AM, Joachim Breitner wrote:
> Hi,
>
> a very small proposal to be considered for Haskell':

	I like it, but it should probably be a GHC proposal first. I don't 
think Haskell' is supposed to make any change to the standard that 
hasn't been already implemented and tested. In this particular case, GHC 
HQ might opt to implement your proposal but hide it behind a 
command-line option, or to enable it by default only in GHCi. There are 
already precedents for this.


>
> Currently, the report states
>
>     An abbreviated form of module, consisting only of the module body,
>     is permitted. If this is used, the header is assumed to be ‘module
>     Main(main) where’.
>
> I propose to change that to
>
>     An abbreviated form of module, consisting only of the module body,
>     is permitted. If this is used, the header is assumed to be ‘module
>     Main where’.
>
> The rationale is that a main-less main module is still useful, e.g.
> when you are working a lot in GHCi, and offload a few extensions to a
> separate file. Currently, tools like hdevtools will complain about a
> missing main function when editing such a file.
>
> It would also work better with GHC’s -main-is flag, and avoid problems
> like the one described in https://ghc.haskell.org/trac/ghc/ticket/13704
>
>
> I don’t see any downsides. When compiling to a binary, implementations
> are still able to detect that a Main module is not imported by any
> other module and only the main function is used, and optimize as if
> only main were exported.
>
> Greetings,
> Joachim
>
>
>
>
>
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime
>


-- 
Mario Blazevic
mblazevic at stilo.com
Stilo International

This message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure, copying, or
distribution is strictly prohibited. If you are not the intended
recipient(s) please contact the sender by reply email and destroy
all copies of the original message and any attachments.


More information about the Haskell-prime mailing list