Making Unreasonable States Impossible
summary
Claim: variant types and pattern matching in Reason plus ReasonReact and Flow produce APIs that are truly impossible to misuse. Examples: a tic‑tac‑toe app with a tuple board of three rows that the compiler rejects if it has the wrong length, exhaustive pattern matching that forces handling of turn/win/draw, and a remote data type (NotAsked/Pending/Success/Error) that prevents invalid loader states. Code compiles via BuckleScript to JS, the demo runs and the compiler catches missing cases at compile time.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:11Type-driven development
- 3:16Tic-tac-toe without types
- 4:41Adding Flow types
- 6:29Refactoring to impossible states
- 9:46Switch statements vs pattern matching
- 11:37Safe board representation
- 14:54Live coding Tic-Tac-Toe in ReasonML
- 23:10Conclusion
- 24:55Handling remote data safely
- 27:23Live coding loader component
- 30:58Summary & Q&A








