Hello, my name is Nicolas Rinaudo and I’m here today because I’d like to talk to you about one of the core features of our favourite language, one that we, as OOP programmers, should be intimately familiar with: inheritance.
Yes, I’m aware that there’s a fringe of the community that refuses to use inheritance on philosophical grounds, and I respect that. I just think it’s a bit of a shame because honestly, I couldn’t work without algebraic data types, and, well, Scala does them with inheritance. Or without type classes, for that matter - anybody that knows me knows I love my type classes - and they’re also done with inheritance in Haskell. I mean in Scala. Well, in both, really.
Don’t believe me? Here’s what the Haskell documentation has to say on the subject (https://www.haskell.org/tutorial/classes.html):
We say that Eq is a superclass of Ord (conversely, Ord is a subclass of Eq), and any type which is an instance of Ord must also be an instance of Eq.