StateMachine
StateMachine copied to clipboard
Question: only states and events (no side effects)
Hi,
I have implemented and ad-hoc Bluetooth connection state machine based on states and events (no need for SideEffects / actions for the moment). I was thinking about switching that state machine to a version created using this library.
Is it possible to create such state machine, or as a minimum I should have at least 1 SideEffect (a dummy one for example)?
Thanks in advance.
I think you can just use Nothing as the side-effect type, and just not pass them at all. (But then, I'm pretty new to this library too....)
Thanks for the suggestion @dave08 . I'm currently not working on this, but should I have some time to try it, I will confirm what you mention here.
Using Nothing for type parameters which you aren't going to use is the correct way. This ensures that there is no way you can accidentally use a side-effect parameter anywhere in your statemachine definition. In transitionTo and anywhere else the effect parameter is optional and the Nothing type won't allow you to pass anything but null.