Skip to main content

Logo for BOB BOB 2020

28th February 2020

Berlin, Germany

Part of the BOB series

Leveraging Algebraic Data Types (Franz Thoma)

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.

This session is held on in Talks B