So far, we’ve run into a lot of data types:
Maybe, and so on. But how do we make our own? In
this chapter, you’ll learn how to create custom types and put them to work!
One way to make our own type is to use the
keyword. Let’s see how the
Bool type is defined
in the standard library.
data Bool = False | True
data keyword like this means that a
new data type is being defined. The part before the equal sign denotes the type,
which in this case is
Bool. The parts after the equal sign are value constructors. They specify the different values that this ...