Default module header `module Main where`
Joachim Breitner
mail at joachim-breitner.de
Fri May 19 22:32:30 UTC 2017
Hi,
I thought about this. But I fear that this will require a language
extension or flag, and then the developers (quite rightly) say that it
does not pull its weight of supporting both variants, and it gets lost.
But maybe I should give it a shot if they accept it.
Joachim
Am Freitag, den 19.05.2017, 17:35 -0400 schrieb Mario Blažević:
> 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/1
> > 3704
> >
> >
> > 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
> >
>
>
--
Joachim Breitner
mail at joachim-breitner.de
http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/haskell-prime/attachments/20170519/0186dcda/attachment.sig>
More information about the Haskell-prime
mailing list