r/functionalprogramming • u/kichiDsimp • Jun 15 '25
Question DSL tutorial and why?
I have heard that FP languages generally make life easier when you want to make a DSL (external/embedded) I guess thats due to patter-matching & ADT(s)
Some good resources, blogs will be helpful
PS: I am currently studying https://keleshev.com/compiling-to-assembly-from-scratch/
9
Upvotes
6
u/NullPointer-Except Jun 15 '25
DSL are closely related to interpreters, search for final tagless interpreters and for tagged initial encodings. Oleg's papers are a favorite of mine https://okmij.org/ftp/tagless-final/
3
u/YelinkMcWawa Jun 15 '25
It's also usually due to the flexibility in calling functions of two parameters as infix so you can effectively make something that looks like a new language.
3
u/recursion_is_love Jun 16 '25
> I guess thats due to patter-matching & ADT(s)
That's what my conclusion too. It is easier to solve a problem that you can model with ADT ,especially with the terse language (like Haskell), the noise and boiler-plate is reduced a lot.