Type error for function main

Josef Svenningsson josefs at cs.chalmers.se
Thu Oct 16 15:35:26 EDT 2003


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



More information about the Hugs-Bugs mailing list