Notions of Stack-manipulating Computation and Relative Monads (Extended Version)
Yuchen Jiang, Runze Xue, Max S. New

TL;DR
This paper explores how monadic effects can be implemented at a lower level using explicit stack manipulation, employing relative monads within a polymorphic CBPV calculus to model and generalize computational effects.
Contribution
It demonstrates that the monadic interface can be adapted to low-level stack manipulation using relative monads and introduces monadic blocks for flexible effect handling.
Findings
Relative monads effectively model stack-based effects.
Standard monads can be adapted to relative monads.
All relative monads extend to relative monad transformers.
Abstract
Monads provide a simple and concise interface to user-defined computational effects in functional programming languages. This enables equational reasoning about effects, abstraction over monadic interfaces and the development of monad transformer stacks to combine different effects. Compiler implementors and assembly code programmers similarly virtualize effects, and would benefit from similar abstractions if possible. However, the implementation details of effects seem disconnected from the high-level monad interface: at this lower level much of the design is in the layout of the runtime stack, which is not accessible in a high-level programming language. We demonstrate that the monadic interface can be faithfully adapted from high-level functional programming to a lower level setting with explicit stack manipulation. We use a polymorphic call-by-push-value (CBPV) calculus as a…
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.
