[Haskell-cafe] Questions on the Haskell 2010 report

Brandon Allbery allbery.b at gmail.com
Sun Jan 8 19:07:36 CET 2012


On Sun, Jan 8, 2012 at 12:53, Silvio Frischknecht
<silvio.frischi at gmail.com>wrote:

>        module  →       module modid [exports] where body
>                |       body
>        body    →       { impdecls ; topdecls }
>                |       { impdecls }
>                |       { topdecls }
>
> You can't see it in this mail because there is no font but
> the curly braces { } are meant to match the tokens { } and are not
> meant as repetition. However, as I understand it, the layout parser
> would modify this code:
>
>        module Foo where
>        import Bar
>        baz=baz
>
> to this code (which doesn't match):
>
>        module Foo where { import Bar ; baz=baz }
>
> and not to this code (which would be required to match):
>
>        module Foo where { { import Bar } ; { baz=baz } }
>

Pardon?  As I read the spec you quoted, the former agrees with it and the
latter does not.   How do you get the (illegal) latter?

2)
> In the same section what is it supposed to mean if "module" consists
> of only a "body" and not "module modid [exports] where body".
>

If you don't name a module, the module is imputed to be Main and the symbol
main is exported from it.  See the final paragraph of Section 5.1.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120108/d4a4f3e6/attachment.htm>


More information about the Haskell-Cafe mailing list