15-150: Principles of Functional Programming

Lecture 9: Polymorphism and Type Inference

We discussed polymorphic datatypes, such as SML's built in lists as well as a user-defined polymorphic tree type.
We wrote a function of type 'a tree -> 'a list.

We discussed the option datatype.

We discussed how SML infers types of values, including functions.

Key Concepts

Sample Code

Type checking, Polymorphism, and Type Inference

Structural Induction revisited for polymorphic lists and trees