Lie <[EMAIL PROTECTED]> writes: > I see, but the same arguments still holds true: the second line have > an implicit side-effect of redefining x's type into Fractional type. > If I were the designer of the language, I'd leave x's type as it is > (as Num) and coerce x for current calculation only.
Num in Haskell is not a type, it is a class of types, i.e. if all you know about x is that it is a Num, then its actual type is indeterminate. Types get inferred, they do not get coerced or "redefined". The compiler looks at expressions referring to x, to deduce what x's type actually is. If it is not possible to satisfy all constraints simultaneously, then the compiler reports an error. -- http://mail.python.org/mailman/listinfo/python-list