|
|
|
|
|
by pjmlp
2118 days ago
|
|
> Haskell type classes have nothing to do with OOP in the least, and as far as I know They surely do, OOP like FP, is very fuzzy and since the Simula/Smalltalk days there have been multiple ways to try to represent OOP concepts. There isn't any OOP language that implements every OOP idea, just like there isn't any FP language that implements every FP idea. Type classes allow for polymorphism, and combined with modules one can make use of module private implementations for the encapsulation part. Extensibility can be achieved either by having a type implement multiple type classes, COM v1..vn style, or by delegation. |
|
By your logic: 1. Ducks have feathers 2. All birds have feathers 3. Therefore, all birds are ducks
In any case, Haskell didn't get its polymorphism from any OOP language, so the point is moot. ML was first to introduce parametric polymorphism in 1975 — Java/C#/etc with their "generics" came later. Even ad hoc polymorphism with type classes was proposed 7 whole years (1988) before Java was even released (1995). And sure, the paper mentions that OOP has to solve similar issues, but "solving the same problem" ≠ "being the same solution".