When your DSL Needs to Support User-Defined Functions
summary
Presents a concrete technique that converts user-written lambdas on placeholder expressions into a pure AST of abstract arrows using the Libretto library, yielding a point-free representation with no Scala functions inside. Demonstrates on a background‑check workflow that supports branching, parallelism, recursion and sharing, and shows how the AST enables durable execution by persisting inputs, continuations and activity promises. Uses extension methods, context functions and path‑dependent types so Scala typechecking handles most errors and the generated arrow compositions avoid capture and unnecessary duplication.
AI-written summary · about
chapters (19)
- 0:00Embedded DSLs and user-defined functions
- 1:16Embedded DSLs vs custom syntax
- 2:41Programs as data and AST control
- 4:52DSL variables challenges
- 6:41Deification to eliminate lambdas
- 9:52Point-free representation for safety
- 11:18User-friendly DSL with AST output
- 12:45Example workflow DSL for background checks
- 18:05DSL code sketching with lambdas
- 20:23User code to pure data structures
- 21:52How deification works
- 24:06Eliminating variables in AST
- 27:21Pattern matching in DSL
- 30:10Loops and recursion without variables
- 31:41AST to workflow execution
- 36:27Execution state as data
- 38:17Scala features enabling approach
- 40:32Key takeaways and future
- 42:01Q&A
related talks
21mBroaden Scala
44mFunctional Interpreters and You
31mAdvanced techniques for building Kotlin DSL(s)
37mIntro to FP in Scala: Exploring a Toolbox for Solving Problems - Part 6 of 6
35mFrom Zero to Three - Building a User Friendly DSL with Scala 3
49mTen Cool Things You Can Do With Scala 3
32mUnderstanding the Type System of Scala 3
35mScala 2.12 & Beyond
