[Haskell-cafe] what I learnt from my first serious haskell
programm
Bulat Ziganshin
bulat.ziganshin at gmail.com
Mon Mar 19 17:29:36 EDT 2007
Hello Fawzi,
Monday, March 19, 2007, 8:26:33 PM, you wrote:
> Maybe I did not express me clearly enough, I think that classes are
> useful (and the language that I was speaking of, aldor, has them), but
> it is not nice that the only way to have an overloaded function is to
> define a type class
overloading without using type classes (as it is implemented in C++)
is hardly compatible with type inference. imagine that you has two
functions:
f :: String -> Int
f :: Int -> Int
and write (f a). what should be type of a? it becomes a list of
possible types. because type inference mechanism pushes inferred types
up and down, the whole information about type of each term will become
much more complicated. compare this to current requirement to overload
using only type classes. in this case, you know that 'a' belongs to
some class, so possible variants don't multiply at each inference step
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list