special handling of "Main.hs" contradicts Report

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Fri Apr 18 05:50:55 EDT 2003


Simon Marlow <simonmar at microsoft.com> 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




More information about the Glasgow-haskell-bugs mailing list