3 ms·
> So you don't use type classes in Haskell? Sorry, how does this remark relates to my comment?
by cies 12y ago
> So you don't use type classes in Haskell?
Sorry, how does this remark relates to my comment?
- dllthomas 12y agoI assume it was intended to be 1) an assertion that type classes are OO, and 2) an implication that using them is mixing OO in your FP (which you said you don't like to do), and so 3) an allegation of inconsistency which should be clarified or examined. There are a few places where this chain is weak.
- pjmlp 12y agoYes.
- cies 12y ago> an assertion that type classes are OO They never occurred to me as OO. Could someone explain this?
- pjmlp 12y agoSure, since I mentioned it. Sorry if I misassume your OOP experience. Many think about OOP as introduced by Simula/Smalltalk, or how it is served by Java/C#... ones. However there are many other ways of doing OOP, which many of us in the old (early 90's) experimented with, while OOP was striving to become mainstream. Type classes in Haskell and their use, can be easilly mapped to interfaces/protocols/traits/... in the OO world. From the OOP point of view, type classes are a group of operations that can be applied to a given type and refereed to by a specific name. Which allows writing polymorphic operations over types that support a specific a specific group of functionality. Polymorphism and data hiding are the common concepts across all OOP proposals. As for the remaining concepts, there are lots of languages that agree to disagree, between mainstream, academia and lost OOP battles. And I can call one of the many Simon Peyton Jones talks that describe this, http://yow.eventer.com/events/1004/talks/1054 http://yow.eventer.com/events/1004/talks/1054, starting at 00:42.
- cies 12y agotnx. very insightful. I'm not fully convinced that type classes are OOP, but I certainly understand why --for a very broad definition of OOP-- one might think they are.
- dllthomas 12y agoTo my mind, the biggest thing missing from typeclasses that you get automatically with many OO systems is a sense of persistent identity of objects. Of course Haskell has ways to roll your own, and I'm not sure the decoupling is a bad thing by any means, but it's a difference.