logo       

Re: special handling of "Main.hs" contradicts Report: msg#00049

lang.haskell.glasgow.bugs

Subject: Re: special handling of "Main.hs" contradicts Report


Simon Marlow <simonmar@xxxxxxxxxxxxx> writes:
> [...] I always thought that if you write 'module Main where' as the
> module header, then the compiler is allowed to interpret it as
> 'module Main (main) where', but I just checked the report and it
> doesn't seem to say that (perhaps it was an older version of
> Haskell? Anyone remember?).

If you omit the module header:

cat > Main.hs
t1 = t1
EOF

then Haskell implicitly adds a module header for you.

cat > Main.hs
module Main( main ) where -- Haskell adds this line for you
t1 = t1
EOF

This implicit header used to be just

module Main where

but '( main )' was added around the time of Haskell 1.4 or 98.

[At least, that's the way I remember it. If you'd asked if anyone had
old reports handy, I might have actually looked it up and given a more
reliable answer :-)]

--
Alastair


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise