Algebraic data types for fun and profit
As domain driven design practitioners, we have to design datastructures a lot. Often we have to encode our knowledge into a not-so-expressive type system. That’s when the trouble starts: our types don’t represent exactly what we have.
Algebraic Data Types (or ADTs) are a very powerful tool and help a lot when it comes to design our data types. Moreover, they share interesting properties with addition and multiplication (hence their name).