OOP vs type classes Re: [Haskell-cafe] type gurus,
can you please help?
bulat.ziganshin at gmail.com
Wed Aug 16 03:07:11 EDT 2006
Tuesday, August 15, 2006, 10:36:28 PM, you wrote:
> | 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.
i can't agree. the differences between TC inheritance/polymorphism and
C++ classes are substantial. i listed them in next part of tutorial which
you should see alongside this message. you can also see paper at
http://homepages.cwi.nl/~ralf/gpce06/ which is all about consequences
of differences between classes and type classes for software
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe