September 2017
Beginner to intermediate
396 pages
9h 46m
English
List is defined as follows:
data [] a = [] -- Empty list or | a : [a] -- An item prepended to a list, is also a list
There are two data constructors. The first data [] constructor shows an empty list, and a list with no elements is a valid list. The second data constructor tells us that an item prepended to a list is also a list.
Also, notice that the type constructor is parameterized by a type parameter a. It means that the list can be constructed with any type a.
Read now
Unlock full access