November 16, 2025, 1:12am 1
Multi-role finite state machine, used for multithreaded programs or distributed programs.
The behaviors of multiple characters are orchestrated into a state machine. Imagine a theater with many characters performing a play. The behaviors of all characters are arranged as a whole in the script. When a certain message is sent, everyone will complete their performance according to the script.
Some similar libraries:
- Home - Choral Language Website
- GitHub - gshen42/HasChor: Functional choreographic programming in Haskell
This project was initially called “polysession,” and I only intended it for developing multi-role communication protocols.
However, I later discove…
November 16, 2025, 1:12am 1
Multi-role finite state machine, used for multithreaded programs or distributed programs.
The behaviors of multiple characters are orchestrated into a state machine. Imagine a theater with many characters performing a play. The behaviors of all characters are arranged as a whole in the script. When a certain message is sent, everyone will complete their performance according to the script.
Some similar libraries:
- Home - Choral Language Website
- GitHub - gshen42/HasChor: Functional choreographic programming in Haskell
This project was initially called “polysession,” and I only intended it for developing multi-role communication protocols.
However, I later discovered its uses extend far beyond communication protocols. For example, you can use it to create game scripts and write multi-threaded programs.
When there is only one participating role, troupe is equivalent to polystate. Or, you can consider polystate as a special case of troupe.
November 16, 2025, 1:28am 2
The troupe allows you to construct the overall control flow of your program through declarative composition and generates the overall control flow diagram through the compiler.
For example, the above definition will generate the following control chart:
The effect during runtime:
