Lecture 7: Polymorphism from Types to Kinds and Beyond

Continuing with types, and in particular some uses in the experimental language laboratory that is Haskell. This lecture covers more on polymorphism, in both object-oriented and functional languages.

Object-oriented languages offer polymorphism and run different code for different objects. For class-based OO languages like Java this ad-hoc polymorphism can require complex resolution of method invocation. In addition, generic code acts on parameterized types to give parametric polymorphism.

Functional languages use parametric polymorphism extensively; Haskell type classes extend it with qualified types to select different code for different types. This gives ad-hoc polymorphism, overloading, inheritance, multiple dispatch, and more.

Types and type constructors are grouped by kind, and even higher kinds; these too can be qualified into constructor classes like Functor.

The lecture slides contain further references for this material.

Thank you for your preliminary coursework reports, which have been safely received. You will get a feedback sheet on them by email this Friday.

Link: Slides

Homework

Friday’s lecture will be about monads and handling I/O in Haskell. Before then, read through this survey by Peyton Jones.

Comments are closed.