Typed Design Patterns for the Functional Era
summary
Argues that some recurring system designs resist being encoded purely as libraries and shows four Rust encodings: Witness, State Machine, Parallel Lists, Registry. Implements the Registry pattern as a working event system using Rust TypeId plus downcasting so the hashmap key is the payload type, not a string, and compilation prevents triggering a click handler with a keypress. Demonstration compiles and runs; trade-offs include subtle mismatches when types use references or wrappers — those remain developer pitfalls. type-driven keys
AI-written summary · about
chapters (6)
- 0:00The quest for FP patterns
- 2:30Defining design patterns
- 5:04Patterns and language design
- 7:24Rust as a functional case
- 11:36The registry pattern
- 25:50Discussion and conclusion
related talks
31mThe Rust That Could Have Been
46mKeynote: Rust is not about memory safety
26mThe Freedom of Static Typing
33mRust and Haskell, sitting in a tree
38mType-level interfaces in Haskell & Rust: pragmatic type-level programming
36mFunctional State Machines in Rust: Typestate and Newtype Patterns
31mFrom C++ APIs to Idiomatic Rust: Wrapper Design Patterns
28mWriting Idiomatic Libraries in Rust
