Type error for function main

Josef Svenningsson <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
Hi!

I was just trying to write the smallest valid Haskell program. One try was
the following:

> main = return 0

But I get the following error message:
ERROR "foo.hs":1 - Unresolved top-level overloading
*** Binding             : main
*** Outstanding context : Monad c

Why do I get this? According to the Haskell report a module where one
doesn't specify the name should implicitly be called Main. And a Main
module have a function main of type IO t for some t. So Hugs should be
able to figure out that the monad should be IO in this case, at least
according the Haskell report.

Cheers,

	/Josef
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.