Re:C++ the Good Parts (2014)
by vbarrielle on Thursday October 01, 2020 @07:47AM
(#24649819)
Haskell typeclasses are quite close to Rust traits, does Haskell count as OOP then?
[ Parent
| on HN ]
Yes, Haskell has all the necessary features to implement some forms of OOP.
There are plenty of OOP flavours, just like there are plenty of FP flavours.
If one considers 100% Haskell's features as must have for a language to be considered FP, then OCaml and Standard ML are going to have a hard time to be considered FP.
IIRC, Haskell doesn't have the notion of object identity. It wouldn't make sense in an immutable language, anyway, because identity only matters if object state can change - otherwise any two objects with identical state are substitutable. But anyway, I would argue that this is the crucial difference that sets apart "objects" and "values with syntactic sugar for function calls".