Efficient, Portable, Census-Polymorphic Choreographic Programming
Mako Bates, Shun Kashiwa, Syed Jafri, Gan Shen, Lindsey Kuper, Joseph P. Near
TL;DR
This work advances library-based choreographic programming by addressing three core challenges: efficient knowledge-of-choice (KoC) management, abstraction over the number of participants, and practical porting to diverse host languages. It introduces conclaves and multiply-located values (MLVs) to enable communication-efficient conditionals, and census polymorphism to parametrically express protocols over arbitrary participant sets. To realize these ideas across languages, the paper proposes endpoint projection as dependency injection (EPP-as-DI), enabling CP libraries in Haskell, Rust, and TypeScript with language-appropriate safety guarantees. Formal development includes a Conclaves-&-MLVs lambda calculus, proofs of soundness and deadlock-freedom, and expressivity comparisons with select-&-merge, complemented by real-language implementations and diverse case studies such as a census-polymorphic KV store, secure lottery, and MPC.Given the practical orientation and rigorous formalism, these contributions enable portable, scalable, and verifiably deadlock-free CP libraries for real distributed systems with variable sizes and heterogeneous language ecosystems.
Abstract
Choreographic programming (CP) is a paradigm for implementing distributed systems that uses a single global program to define the actions and interactions of all participants. Library-level CP implementations, like HasChor, integrate well with mainstream programming languages but have several limitations: Their conditionals require extra communication; they require specific host-language features (e.g., monads); and they lack support for programming patterns that are essential for implementing realistic distributed applications. We make three contributions to library-level CP to specifically address these challenges. First, we propose and formalize conclaves and multiply-located values, which enable efficient conditionals in library-level CP without redundant communication. Second, we propose end-point projection as dependency injection, a design pattern that enables library-level CP in host languages without support for monads. Third, we propose census polymorphism, a technique for abstracting over the number of participants in a choreography. We demonstrate these contributions via implementations in Haskell, Rust, and TypeScript.
