List Functions
We have already introduced the list type. A list storing values of type a
has
type [a]
. Such a list is either empty, []
, or consists of an element x
followed by a list xs
containing the remaining elements, x : xs
.
data [] a = [] | a : [a]
I have also used a number of different list functions as examples of recursion and other programming constructs in previous chapters. For reference, we will collect them here in one place.