On Tue, May 16, 2017 at 10:18:51AM -0400, Joachim Breitner wrote:
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’.

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.

Initially I was concerned that this proposal would implicitly export everything from Main, which would then prevent compilers from warning about unused values, since they can't tell if seemingly-unused things are in fact being exported for use elsewhere (perhaps by a program that is not currently being compiled, so looking at what exported values are used elsewhere is not a solution).

Then I started wondering if a standards-compliant Haskell program can ever import anything from a module called Main (because module names should be unique across a program, and there should be a Main module at the root of the dependency graph).

Then I started wondering about a Main module that was mutually recursive with another module.

I've ended up uncertain, so I'll just throw it out there: are unused value warnings affected by this proposal?
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime

Reply via email to