Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Modeling Data with Algebraic Data Types


What is "good code"? You've probably heard something like "readable, easy to change, modular, and correct". But what does that look like in practice?

Elm's Algebraic Data Types give us some powerful tools to do just that. We'll walk through a series of modeling problems and see how ADTs can make your life easier. Want to differentiate between two similar pieces of data? Model state changes? Create readable configuration? There's an ADT for that!

This talk will equip you to move beyond modeling with strings and records.


This talk will look at a series of common problems and how we can use Elm's ADTs to solve them. We will look at some programming classics such as the "three-state boolean" as well as some Elm-specific ones like "How can we help the compiler give us better errors here" and even some purely aesthetic issues like "how can we make this code easier to understand?"

The talk assumes a beginner understanding of Elm but doesn't assume any knowledge of ADTs. Beginners should leave feeling much more comfortable with ADTs while more advanced users should take away some useful data modeling tricks.


When I first started with Elm, I used primitives such as strings and records for everything. Learning to work with ADTs helped me take data modeling to the next level and solved many problems I'd previously struggled with.

I've helped out many new Elm developers and a lot of them struggle when trying to model their data using only primitives, just as I used to. I want to share the awesomeness of ADTs and how adding some to your project can improve readability, changeability, and correctness

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.