The following program compiles fine with ghc 4.04,
x = 1
main = print (x :: Int)
but when I try it with the "May 1999" version of Hugs,
I get a type error:
ERROR "bug2.hs" (line 2): Type error in type annotation
*** Term : x
*** Type
Hello Fergus,
x = 1
The monomorphism restriction means that functions without parameters should
in principle not be overloaded. The fact that Hugs doesn't complain is
probably because some "default" mechanism is at work. And it happens to
choose Integer as a default.
If you want the
No - ghc is quite right on this one. The use of x in the module
disambiguates the overloading of x here - any use of x in the module
that resolves the overloading should make the monomorphism rule
happy. Unfortunately, hugs applies defaulting too soon and the use of
x that would satisfy
A quick question: what is the intended behaviour of the
Hugs/ghc extension types Int8, Int16, Int32, and Int64
with regard to overflow? The documentation for the Word*
types says that they compute modulo arithmetic, but there
is no similar guarantee for the Int* types. Is it the
intention that