Finite-state machines? Your compiler wants in!
summary
Concrete examples show how to encode a checkout FSM end to end: Haskell ADTs + IO runner models states and events, then an MTL-style type class with associated state separates abstract program from concrete GADT-based instance, and an indexed monad demo makes illegal reuse (placing an order twice) a compile-time type error. PureScript row types illustrate composing multiple named machines, and Idris examples use dependent types to track item counts and proofs. Demos compile and run, warn that error-handling and large hierarchies get awkward.
AI-written summary · about
chapters (32)
- 0:00Introduction
- 1:04Stateful programs
- 2:01Finitestate machines
- 4:01Checkout example
- 9:31MTL style
- 10:19Type class
- 11:43State types
- 14:46Cancel states
- 15:13Complete type
- 16:34Transition state
- 17:39Checkout instance
- 18:18Concrete state type
- 21:27Summary
- 22:53Reusing state
- 24:16Index Monas
- 25:41Index Monas with bind
- 27:53Index State Monitor
- 28:10Multiple State Machines
- 28:57Pure Script
- 30:19Type Signature
- 31:15Idris
- 32:04Items
- 32:58State
- 33:11State type
- 33:23State has items
- 33:57Check out
- 34:32Proof
- 35:49CheckoutShop
- 36:32Total
- 37:00Forever
- 37:22Summarize
- 38:34Key Tech
related talks
20mTaming UI complexity with Typed State Machines
25mMastering UIs with Finite State Machines
09mA State Machine walks into a Svelte Component
28mState machines for frontend state management
44mManaging Complex Application State with Finite-State Machines
30mMastering UIs with Finite State Machines
24mLeveraging the Power of State Machines in Swift
50m"No Foul Play" Describing State with Dependently Typed FSMs
