Choreographic programming is an emerging programming paradigm for writing distributed programs. Instead of writing code individually for each node in a distributed system and then assembling them together—which could lead to errors like deadlocks due to mismatches between sends and receives—choreographic programming allows writing a single program (called a choreography) that describes the behavior of the whole system and then automatically generating code for each node via a technique called endpoint projection. By having a global view of message communication, choreographic programming not only provides an integrated way to write distributed programs, but also guarantees deadlock freedom by design.
Although previous work on choreographic programming has developed its metatheory substantially, a practical implementation is still lacking, especially in the context of functional programming. In this paper, we present HasChor, a domain-specific language in Haskell for choreographic programming. HasChor provides users with a monad for writing choreographies and an endpoint projection function for translating a choreography to equivalent concurrent programs. We hope HasChor can serve as a platform for future research into functional choreographic programming and help its adaption in the real world.