Declaring types and classes
In this chapter we introduce mechanisms for declaring new types and classes in Haskell. We start with two approaches to declaring types, then consider recursive types, develop a tautology checker and an abstract machine, and conclude by showing how to declare classes and their instances.
10.1 Type declarations
The simplest way of declaring a new type is to introduce a new name for an existing type, using the type mechanism of Haskell. For example, the following declaration from the standard library states that the type String is just a synonym for the type [Char] of lists of characters:
As in this example, ...