I would like to announce the first release of crem
crem stands for compositional representable executable machines.
It allows defining state machines (Mealy machines in fact), composing them to build bigger machines out of smaller ones and then running them and drawing their flow and their state space.
The repository contains extensive documentation and several examples, including domain modelling with state machines and a terminal-base adventure game.
Please check it out and let me know how it could be improved
Do you have any comparison against machines?
Good to see another approach to state machines.
Type safe state transitions are a nice feature (for example hobbitTopology).
I am no machines expert, but I’ll try to provide some thoughts:
machines focus appears more to be on creating a streaming library, like pipes or conduit, and it happens to use state machines. crem on the other is (at least for now) only a state machine library. Maybe it would be possible to provide a AutomatonT instance for cremStateMachineT type, so that you can then use crem state machines inside the machines framework.
machinesMachines are demand driven (I guess this means that they will proceed in their evaluation only if there is request of another output), while cremStateMachine will execute until it is finished.
crem focuses more on type safety and the ability to create a graphical representation out of a state machine
I haven’t tested performance-wise. I guess compilation times could be higher for crem but I expect run times to be similar
I reached for this yesterday and found that it didn’t compile with 9.10. So I rolled up my sleeves and updated it with new version bounds. I was about to submit a pull request but I didn’t know how to handle the literate Haskell doctest part.
Here’s my update so far:
And here’s where I immediately put it to work on my backend API where it prevents illegal state changes at the type level along with additions to my tests to verify the veracity of that claim: cheeblr/backend at crem2 · harryprayiv/cheeblr · GitHub
Thanks for your brilliant work. I feel that I’m finally reaching the point in my journey where I’m starting to understand why so many are anxiously awaiting dependent types.