To present the Miranda algebraic type mechanism, by means of a graduated
series of examples.
To compare algebraic types with other Miranda types, including tuples and
To explain recursive definitions over algebraic types, both by structural
recursion and by more general forms of recursion.
To present case studies of polymorphic algebraic types, which are strong
candidates for re-use.
To examine how data type definitions can be designed step-by-step; the
examples introduced here are taken up in subsequent chapters.
To show how to reason about definitions over algebraic types.
The simulation and calculator examples are taken up in subsequent chapters; it
would be quite possible to cover the examples in one session, but only later
in the course.
A number of exercises in the chapter are open-ended, calling as they do for
the design of data types to model various situations. These can form a
focus for a small-group discussion, in which students are encouraged to
compare their designs with others, and to evaluate their suitabilty for
purpose. The implicit message of such exercises is important: there is more to
the programming process than sitting in front of a terminal, coding.
Written 18 May 1995.