一句话:提出基于 monad 的函数式编排编程模型,支持高阶与位置多态编排,并实现为 Haskell 库 HasChor。
编排编程是一种面向分布式系统的新兴范式:程序员用单一全局程序描述整个系统行为,再通过 endpoint projection 编译为各节点程序。本文提出函数式编排编程的新模型,将 choreography 表示为 monad 中的计算,并支持高阶 choreography(可作为参数传递)与位置多态 choreography(可抽象节点),从而提升模块化与代码复用。该模型实现为 Haskell 库 HasChor,使日常 Haskeller 能直接使用丰富的 Haskell 生态编写编排程序;得益于 Haskell 的抽象,库本身实现简洁,endpoint projection 被归结为简短而本质的形式。
Choreographic programming is an emerging paradigm for programming distributed systems. In choreographic programming, the programmer describes the behavior of the entire system as a single, unified program -- a choreography -- which is then compiled to individual programs that run on each node, via a compilation step called endpoint projection. We present a new model for functional choreographic programming where choreographies are expressed as computations in a monad. Our model supports cutting-edge choreographic programming features that enable modularity and code reuse: in particular, it supports higher-order choreographies, in which a choreography may be passed as an argument to another choreography, and location-polymorphic choreographies, in which a choreography can abstract over nodes. Our model is implemented in a Haskell library, HasChor , which lets programmers write choreographic programs while using the rich Haskell ecosystem at no cost, bringing choreographic programming within reach of everyday Haskellers. Moreover, thanks to Haskell's abstractions, the implementation of the HasChor library itself is concise and understandable, boiling down endpoint projection to its short and simple essence.
@article{paperbot1908,
title = {HasChor: Functional Choreographic Programming for All (Functional Pearl)},
author = {Gan Shen and Shun Kashiwa and Lindsey Kuper},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {ICFP},
year = {2023},
doi = {10.1145/3607849}
}