Making Impossible States Impossible
summary
Shows concrete techniques in Elm to make invalid UI states unrepresentable: handling CSS at-rules (the @charset rule must be first) by avoiding lists of interchangeable declarations, replacing validation-and-sort with a typed model so invalid sheets simply won’t compile; modeling surveys with paired records, a non-empty list (first+others), and a zip list (previous/current/remaining) so current is always valid; and keeping a stable API via a single-constructor union that makes internal upgrades nonbreaking. Results: far fewer tests, compile-time errors instead of runtime mystery bugs, and simpler runtime logic.
AI-written summary · about
chapters (12)
- 0:00Introduction and setup
- 1:17Elm CSS and invalid states
- 5:07Validating and sorting CSS rules
- 6:12Making invalid states impossible
- 8:58Survey app example
- 11:04Coupling prompts and responses
- 13:08Ensuring at least one question
- 14:30Zip list for navigation
- 15:53Upgrade experience without breaking changes
- 19:45Hiding implementation details
- 21:29Status bar with undo functionality
- 23:38Key considerations and summary
related talks
38mConfident Frontend with Elm
39mDeveloper Happiness on the Front End with Elm
29mRethinking All Practices "Building Applications in Elm"
30mElm the Game Changer
47mElm or how I learned to love front end development
41mWriting Reliable Web Apps With Elm
56mSimplifying Web App Development With Elm and Functional Programming
16mElm as an antidote to front-end fatigue
