Generics and Constrained Polymorphism versus Subtyping

functional-programming, haskell, oop, programming-languages, scala

Solution

Oleg Kiselyov and Ralf Lämmel's "Haskell's overlooked object system" proposes a library for Haskell that implements an object system using Haskell's existing features, including type classes.

An excerpt from the "introduction" section of the paper (emphasis mine):

The interest in this topic is not at all restricted to Haskell researchers and practitioners since there is a fundamental and unsettled question — a question that is addressed in the present paper:

What is the relation between type-class-bounded and subtype polymorphism?

In this research context, we specifically (and emphatically) restrict ourselves to the existing Haskell language (Haskell 98 and common extensions where necessary), i.e., no new Haskell extensions are to be proposed. As we will substantiate, this restriction is adequate, as it allows us to deliver a meaningful and momentous answer to the aforementioned question.

Problem

In this PDF presentation on Haskell Type Classes, slide #54 has this question: Open Question: In a language with generics and constrained polymorphism, do you need subtyping too? My questions are: How do generics and constrained polymorphism make subtyping unnecessary? If generics and constrained polymorphism make subtyping unnecessary, why does Scala have subtyping?

Original source