Developing DSLs with FP: Exploring 3 Strategies Through Examples
summary
Compares three concrete DSL strategies with Cardano examples: standalone low-level UPLC uses an untyped lambda core whose evaluator (the CEK machine) literally fits on a napkin, making correctness and formalization practical; surface standalone Aen compiles to UPLC but adds heavy adoption cost. Embedded EDSLs like Plutus and Copilot expose AST constructors and leak special syntax, making programs nonstandard. Subset approach implemented as a GHC plugin (PlutusTx/Plin) reuses the compiler core (about 10 core constructors) so code looks like plain Haskell and works well, but plugin support is fragile across GHC versions.
AI-written summary · about
chapters (16)
- 0:00DSLs and FP introduction
- 4:18What is a standalone DSL
- 10:22When to use standalone DSLs
- 13:31UPLC low-level DSL example
- 17:44Standalone DSLs as config
- 19:10Aiken surface language
- 20:37Embedded DSLs concepts
- 25:31Plutus embedded example
- 26:53Rebindable syntax
- 28:18Flight control DSL
- 30:42Subset approach
- 31:48Quoted DSLs syntax
- 35:21Haskell quoted example
- 38:54Plutarch TX subset
- 41:00Subset DSL drawbacks
- 44:56Summary
related talks
25mFree without Pure: eDSL framework Plutarch
28mFrom Lambda to Ledger: An Architectural Comparison of Plinth and Plutarch
29mPlinth: A Plugin-Powered Language Built on Haskell (Experience Report)
44mFunctional Interpreters and You
37mIntro to FP in Scala: Exploring a Toolbox for Solving Problems - Part 6 of 6
41mThe Dialectics of Type-Level Programming
42mFunctional interpreters and you
48mDescribe & Conquer (& Freek)
