> 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.)
In two words: polymorphic recursion. You'll find that the compiler won't be able to derive a type for 'x' in either of the two examples you gave, but x has several types the most general of which is 'forall a. a' (ie. your first example). The fact that x has type 'forall a. a' is also a useful hint as to its behaviour - the only value that has such a type is bottom. Cheers, Simon _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell