←back to thread

115 points goless | 3 comments | | HN request time: 0.67s | source
Show context
goless ◴[] No.44351819[source]
Hi everyone, I developed an interesting library Polystate: Composable Finite State Machines

Since I only have experience in haskell and zig, I'm curious if there are other languages or libraries with similar implementations?

replies(6): >>44351895 #>>44352068 #>>44352576 #>>44352757 #>>44353562 #>>44353893 #
1. noelwelsh ◴[] No.44353893[source]
There are examples in Scala in the "Indexed Data" chapter of my book-in-progress: https://scalawithcats.com/dist/scala-with-cats.pdf
replies(1): >>44361812 #
2. goless ◴[] No.44361812[source]
I once wrote a library typed-fsm https://github.com/sdzx-1/typed-fsm

It has a completely type-safe finite state machine, and it does not require additional programming conventions.

It relies on a special monad: Mcbride Indexed Monad, which can model uncertainty in terms of type.

Are you using this monad here?

Here is a concrete ATM demo https://github.com/sdzx-1/typed-fsm/tree/main/examples/ATM

replies(1): >>44361850 #
3. goless ◴[] No.44361850[source]
In fact, relying on this monad, we can achieve full type safety for multi-role communication.

https://github.com/sdzx-1/typed-session