How algebraic data types make reactive state machines explicit, exhaustive, and type-safe




Reactive programming has a dirty secret: state is almost always a finite state machine in disguise, but nobody draws the diagram. You end up with a loading boolean here, a data field that might be null there, an error that coexists awkwardly with both....