Welcome to the Parti(tioning) (Functional Pearl): Using Rewrite Rules and Specialisation to Partition Haskell Programs
Paper in proceeding, 2024

Writing distributed applications is hard, as the programmer needs to describe the communication protocol between the different endpoints. If this is not done correctly, we can introduce bugs such as deadlocks and data races. Tierless and choreographic programming models aim to make this easier by describing the interactions of every endpoint in a single compilation unit. When such a program is compiled, ideally, a single endpoint is projected and the code for the other endpoints is removed. This leads to smaller binaries with fewer dependencies, and is called program partitioning. In this pearl, we show how we can use rewrite rules and specialisation to get GHC to partition our Haskell programs (almost) for free, if they are written using the Haste App or HasChor framework. As an example of why partitioning is useful, we show how an example application can be more easily built and deployed after being partitioned.

Specialisation

Tierless Programming

Choreographic Programming

Program Partitioning

Haskell

Rewrite Rules

Author

Robert Krook

Chalmers, Computer Science and Engineering (Chalmers), Functional Programming

Samuel Hammersberg

University of Gothenburg

Chalmers, Computer Science and Engineering (Chalmers), Functional Programming

Haskell 2024 - Proceedings of the 17th ACM SIGPLAN International Symposium on Haskell, Co-located with: ICFP 2024

27-40
9798400711022 (ISBN)

17th ACM SIGPLAN International Symposium on Haskell, Haskell 2024, co-located with ICFP 2024
Milan, Italy,

Subject Categories

Computer Engineering

Computer Science

Computer Systems

DOI

10.1145/3677999.3678276

More information

Latest update

9/23/2024