Haskell CS 421 LogoCS 421 — Programming Languages

Algebraic Data Types

If a language is to be extensible at all, it has to give the programmer a way to define new types.

Haskell provides user-defined disjoint types as one of its solutions to this problem. A disjoint type is a type that has more than one kind of constructor. These turn out to be very useful in representing expressions of a programming language internally, so we will make heavy use of them.

We will also cover pairs, which we will use a lot, and records, which we will use infrequently.

Videos

Activitites

Further Reading

  • Generalized Algebraic Data Types     There is a more general version of the product types supported by the language. They are more powerful than the types we will use in class, and you may find them useful in your own programming.