July 2018
Intermediate
186 pages
3h 24m
English
In this section, we'll be exploring ad hoc polymorphism, but through the usage of type classes.
In computer science, polymorphism is the provision of a single interface to entities of different types. Polymorphism consists of three types: subtyping, parametric polymorphism, and ad hoc polymorphism.
Subtyping enables polymorphism by having different implementations of the same method (but keeping the interface) in the different subclasses. Parametric polymorphism enables polymorphism by allowing code to be written without the mention of a specific type. For example, when you operate over a generic
List, you're applying parametric polymorphism. Ad hoc polymorphism enables polymorphism by allowing ...
Read now
Unlock full access