Tom Anderson <[EMAIL PROTECTED]> wrote: ... > Haskell is strongly and statically typed - very strongly and very > statically!
Sure. > However, what it's not is manifestly typed - you don't have to put the > types in yourself; rather, the compiler works it out. For example, if i > wrote code like this (using python syntax): > > def f(x): > return 1 + x > > The compiler would think "well, he takes some value x, and he adds it to 1 > and 1 is an integer, and the only thing you can add to an integer is > another integer, so x must be an integer; he returns whatever 1 + x works > out to, and 1 and x are both integers, and adding two integers makes an > integer, so the return type must be integer", and concludes that you meant hmmm, not exactly -- Haskell's not QUITE as strongly/rigidly typed as this... you may have in mind CAML, which AFAIK in all of its variations (O'CAML being the best-known one) *does* constrain + so that "the only thing you can add to an integer is another integer". In Haskell, + can sum any two instances of types which meet typeclass Num -- including at least floats, as well as integers (you can add more types to a typeclass by writing the required functions for them, too). Therefore (after loading in ghci a file with f x = x + 1 ), we can verify...: *Main> :type f f :: (Num a) => a -> a A very minor point, but since the need to use +. and the resulting lack of polymorphism are part of what keeps me away from O'CAML and makes me stick to Haskell, I still wanted to make it;-). Alex -- http://mail.python.org/mailman/listinfo/python-list