Effects Without Monads: Non-determinism -- Back to the Meta Language
Oleg Kiselyov (Tohoku University, Japan)

TL;DR
This paper explores an alternative to monadic programming by using a first-order effectful DSL with a macro system, demonstrating its effectiveness for non-determinism and other effects in modern functional languages.
Contribution
It introduces a non-monadic approach using a problem-specific DSL with macro support, enabling elegant expression and analysis of complex effects like non-determinism.
Findings
Non-deterministic programs can be written naturally in ML-like languages.
The approach allows static analysis, optimization, and compilation of effectful programs.
The DSL can be extended easily using tagless-final style embedding.
Abstract
We reflect on programming with complicated effects, recalling an undeservingly forgotten alternative to monadic programming and checking to see how well it can actually work in modern functional languages. We adopt and argue the position of factoring an effectful program into a first-order effectful DSL with a rich, higher-order 'macro' system. Not all programs can be thus factored. Although the approach is not general-purpose, it does admit interesting programs. The effectful DSL is likewise rather problem-specific and lacks general-purpose monadic composition, or even functions. On the upside, it expresses the problem elegantly, is simple to implement and reason about, and lends itself to non-standard interpretations such as code generation (compilation) and abstract interpretation. A specialized DSL is liable to be frequently extended; the experience with the tagless-final style of…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Software Engineering Research · Model-Driven Software Engineering Techniques
