Polymonadic Programming
Michael Hicks (University of Maryland, College Park), Gavin Bierman, (Microsoft Research), Nataliya Guts (University of Maryland, College Park),, Daan Leijen (Microsoft Research), Nikhil Swamy (Microsoft Research)

TL;DR
This paper introduces polymonads, a generalization of monads that allows for composing computations with three different effects, providing a flexible framework for effectful programming in functional languages.
Contribution
It formalizes polymonads, demonstrates their expressiveness, and develops a core language with type inference and elaboration supporting polymonadic programming.
Findings
Polymonads subsume monads and parameterized monads.
Type inference in lambda-PM computes principal types.
Elaborated programs are semantically coherent regardless of bind choices.
Abstract
Monads are a popular tool for the working functional programmer to structure effectful computations. This paper presents polymonads, a generalization of monads. Polymonads give the familiar monadic bind the more general type forall a,b. L a -> (a -> M b) -> N b, to compose computations with three different kinds of effects, rather than just one. Polymonads subsume monads and parameterized monads, and can express other constructions, including precise type-and-effect systems and information flow tracking; more generally, polymonads correspond to Tate's productoid semantic model. We show how to equip a core language (called lambda-PM) with syntactic support for programming with polymonads. Type inference and elaboration in lambda-PM allows programmers to write polymonadic code directly in an ML-like syntax--our algorithms compute principal types and produce elaborated programs wherein the…
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.
