What FP Can Learn From Formal Languages: Towards a Leaner Syntax
summary
Argues that much syntactic overhead is accidental and shows concrete experiments: code in Haskell and Scala, property-based testing and example generation, graph-based diagrams, and a GitHub prototype that uses Scala 3 union types plus implicits to encode algebraic disjunctions. Demonstrates composing validators from string→address→shipment, recovering errors and preserving precise error unions, but notes JVM type-erasure, compiler totality quirks, and messy implicit lifting. Proposes embracing structurality and algebraic composition and treating terminals first-class to get DSL-like syntax without losing HKTs and parametricity.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:23Syntax in FP matters
- 3:34Types and grammar rules
- 9:26Algebraic encoding
- 15:54Live coding: Scala 3 Union types
- 31:55Debugging demo
- 54:48Error recovery with Union types
- 1:01:10Summary
related talks
30mConcrete Syntax Metapatterns
48mA Field Guide to DSL Design
52mAll the Languages Together
01h 00mFunctional architecture - The pits of success
26mThe Power Of Small Abstractions
46mFinite-state machines? Your compiler wants in!
34m[Eng Sub]Is it Okay to Pursue Functional Programming on Frontend?
04mLightning talk - Expressions of Change
