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.

