Functional Interpreters and You
summary
Compares two DSL encodings and shows concrete tradeoffs: reified ASTs support pattern-match interpreters, pretty‑printing, an AST‑rewriting compiler and parallel evaluation via Scala Futures, while monadic sequencing (implemented with free monad) gives automatic pure/flatMap, foldMap and natural transformations at the cost of losing static inspection. Presents the Church/tagless route where an tagless final encoding binds F to Future or Id for async vs sync interpreters, with far less boilerplate and easy DSL composition.
AI-written summary · about
chapters (32)
- 0:00Intro
- 1:03Cat
- 1:43Scala
- 2:01Program
- 2:35Domain Specific Languages
- 3:09Split the Code Base
- 3:53Modularity and Reuse
- 5:23Interpreter Patterns
- 14:09Types
- 15:27Patterns
- 15:44Type Errors
- 16:37Complete Implementation
- 16:52Key Point
- 17:33Type
- 19:02Future
- 19:18PrettyPrint
- 20:34Explicit Ordering
- 21:54Flat Map
- 23:04Sequencing
- 24:19Parallel
- 24:45Inspection
- 25:20Compilers
- 29:48Smart constructors
- 30:07The interpreter
- 30:31The natural transformation
- 32:18The drawback of using free monad
- 32:57Church and Coatings
- 36:11Tagless Final
- 41:00Recap
- 41:13Interpreter Pattern
- 42:41Standalone vs Embedded
- 43:03Links
related talks
42mFunctional interpreters and you
34mA Year living Freely
37mIntro to FP in Scala: Exploring a Toolbox for Solving Problems - Part 6 of 6
33mAnalyzing Functional Programs
46mInventing a language (placeholder title)
42mWhen your DSL Needs to Support User-Defined Functions
35mBuilding a Tagless Final DSL for WebGL in Scala
41mWhy the free Monad isn't free
