Immutable APIs and mutable internals: a Scala design case study
summary
Builds a parser combinator library in Scala with an immutable API but a hidden mutable backend that keeps a pointer into an immutable input string, uses a sealed trait and protected mutable methods so mutability is bounded, and implements combinators and a JSON parser via a lawful parser type class. Benchmarks show dramatic speedups (roughly 7–10× in the demo) with tests asserting lawfulness and correctness, so the approach works.
AI-written summary · about
chapters (8)
- 0:00Motivation for the talk
- 2:10Parser design fundamentals
- 5:57Core algebraic concepts
- 10:05Immutable implementation
- 12:59Performance challenges
- 15:40Principled mutation strategy
- 18:05Optimized parsing techniques
- 21:28Results and conclusion








