What? and Why?

What's an algebraic data type you may ask. Sure you know some algebra like 5 + x = 7. But what has this to do with data types? An algebraic data type is based more on the idea of algebraic structures, which are a set of possible values and one ore more operators to combine a finite number of these values to a single one. A well known structure for example is (ℤ, +, -), the set of all integers with the plus and minus operations on them.

So an algebraic data type is a data type, that is created by algebraic operations. Specifically by sum and product as our operations. See the following example in Haskell for it.

-- product means a combination of values. In this case two Ints
data Point = Point Int Int

-- sum means an alternation between values. True or False, but not both