Finite-State Machines, Part 1: Modeling with Haskell Data Types

from blog Oskar Wickström, | ↗ original
Stateful programs often become complex beasts as they grow. Program state incohesively spread across a bunch of variables, spuriously guarded by even more variables, is what I refer to as implicit state. When working with such code, we have to reconstruct a model mentally, identifying possible states and transitions between them, to modify the...