Making impossible states Impossible
A good coding practice in Elm is to define the Model such that impossible states can not occur.
Instead of writing
one can use
In this section we will look at common ways how to avoid impossible states.
Further reading
🎥Video: Making impossible states impossible by Richard Feldman
❗Example: Tic Tac Toe
❗Example: Subset of {a,b}
❗Example: Up to 2 choices of a set
Last updated