Why is this function type-correct

Rijk J. C. van Haaften rjchaaft@cs.uu.nl
Mon, 04 Mar 2002 15:11:15 +0100


Hello,

Recently, I wrote a function similar to

x :: a
x = x 42

which is type-correct (Hugs, Ghc, THIH).
Still, from the expression it is clear
that the type shoud have a function type.
The definition

x :: a -> b
x = x 42

is equally well accepted, though I can't
see why this type would be correct. (I'd
expect it to be too general.)

For what reasons are these types considered
correct?

Thanks,

Rijk-Jan