In functional programming languages, Algebraic Data Types and Pattern Matching
are ubiquitous, and they are a very powerful and expressive tool. Unfortunately,
many mainstream languages, especially in the object-oriented spectrum, lack
these features and resort to rather cumbersome subtyping and inheritance.
But not all is lost! Leveraging an old GoF pattern together with Lambda syntax
that by now has spread to most modern programming languages, we can emulate ADTs
and pattern matching in virtually any programming language.
Applications range from implementation of standard ADTs like `Maybe`, Tuples and
`Either` over standard functional data structures like Linked Lists and
Fingertrees, up to complex structures like ASTs or DSLs.