Small, Fast, & Simple

February 26, 2015

Algebraic Data Types

Small
Fast
Simple

One of my favorite features of Haskell and other ML-inspired languages, such as Elm, is their support for algebraic data types (ADTs). ADTs are, in part, small data structures, but they can be combined, unpacked, and dispatched on in ways most statically typed languages don’t offer. For me, it took hands on usage of ADTs to really appreciate them. They provide a very natural way to express what various values are, without resorting to heavy-handed or over-sized classes.