Technique for writing debuggable Haskell functions
summary
Practical technique: split a stateful Haskell step function into describe and apply, where describe produces a list of change events (eight distinct kinds in the example) and apply deterministically updates history; composing them must satisfy describe ∘ apply ≡ step. Implementations use Reader for describe, simple apply ~ half a screen of code, and tests assert both output and the intermediate change list; also demonstrated with free monad lifting (parsec-free) and stream/Vector build–fold analogies.
AI-written summary · about
chapters (17)
- 0:00Introduction to talk
- 0:47Debugging trading software
- 3:11Debugging challenges
- 4:33Splitting step into describe and apply
- 7:44Benefits of decomposition
- 8:47Compiler and vector examples
- 11:56Pattern value for testing
- 12:16Mid-talk Q&A
- 13:23Describe non-lossy requirement
- 14:50MapReduce and homomorphisms
- 15:10Free monad example
- 17:41Debugging Parsec parsers
- 19:06Generalizing the pattern
- 20:31Con extensions definition
- 21:12Left and right con extensions
- 21:55Category theory insight
- 22:16Future exploration
