We have so far only scratched the surface of the many kinds of useful data types that can be created in Haskell. In this chapter I will introduce the use of recursive and tree-shaped data types. In the process we will look at a few motivating examples of trees, but will use them more concretely in the next chapter when we create a data type of geometric regions.
7.1 A Tree Data Type
In Chapter 2 we defined a data type called Shape:
Note that every value created of this type has the same relative size, except that the list of vertices in a polygon can be arbitrarily long. In fact, lists are an example of a data type ...