[Haskell-cafe] type gurus, can you please help?
Gabriel Dos Reis
gdr at integrable-solutions.net
Tue Aug 15 14:36:28 EDT 2006
Bulat Ziganshin <bulat.ziganshin at gmail.com> writes:
[...]
| Moreover, Haskell type classes supports inheritance. Run-time
| polymorphism together with inheritance are often seen as OOP
| distinctive points, so during long time i considered type classes as a
| form of OOP implementation. but that's wrong! Haskell type classes
| build on different basis, so they are like C++ templates with added
| inheritance and run-time polymorphism! And this means that usage of
| type classes is different from using classes, with its own strong and
| weak points.
Roughly Haskell type classes correspond to parameterized abstract
classes in C++ (i.e. class templates with virtual functions
representing the operations). Instance declarations correspond to
derivation and implementations of those parameterized classes.
More information about the Haskell-Cafe
mailing list