3 ms·
Haskell typeclasses are quite close to Rust traits, does Haskell count as OOP then?
by vbarrielle 6y ago
Haskell typeclasses are quite close to Rust traits, does Haskell count as OOP then?
- pjmlp 6y agoYes, 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.
- int_19h 6y agoIIRC, 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".