Skip to content

Comment on Haskell: OOP vs type classesparent

Comments

I would say the closest OO analog to ADTs is the Visitor pattern: You first fix the number of classes and then implement the different functions (visitors)

This is in contrast with the normal OO polymorphism/method where you first define set of methods and then implement the different classes.

----------

Type classes are more of a thing of their own. The template comparison is apt and I have heard Type Classes are supposedly very similar to the "Concepts" proposal that did not get in C++0x.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.