| the following program is accepted by Hugs98 (March1999),
| 
|    module Main where { main :: a ; main = undefined }
| 
| It shouldn't be :-)

What you've written here is a module, not a program.  Why
shouldn't that module be accepted by Hugs?  It seems to be
a valid module definition to me.

I agree that such a module could not be used in any Haskell
program because it would clash with the Main.main :: IO t
that another module would have to provide.  But Hugs doesn't
have a notion of a complete program; you just get a collection
of modules, and can move from the scope of one to the other
using a :m command.  You don't have to have any modules with
definitions for main (for example, when only the Prelude is
loaded), but you could also load up more than one module with
a definition for main, so long as you avoid scope clashes.
I think this is the right behavior for an interpreter.  Alas,
the language used in the Haskell report is sometimes a little
too compiler-centric.

On the other hand, runhugs does have a notion of program,
and rejects your example, as it should.  (Although I readily
acknowledge that the error message it produces in this case
is appallingly confusing.)

All the best,
Mark

Reply via email to