Algebraic data types are data structures built from sums, products and recursive types, admitting an algebra. Descriptions of types given as ADTs may be manipulated symbolically to derive other related data structures. The logic for building types algebraically is related to combinatorial species in combinatorial mathematics.
On the algebraic notation for such types:
X
for the singleton container type+
for choice between two types (tagged unions)•
for the ordered product of two types- and a least fixed-point operator, that may be implicit.
Additionally, we have:
0
for the empty type1
for unitX^2
forX•X
Thus, we can describe e.g. the type of binary trees as:
B = 1 + X • B^2
or the type of inductive lists:
L = 1 + X • L
Regular data structures described in this form are the core of algebraic data types as found in Haskell or ML.