Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: only states and events (no side effects) #53

Open
Dario-GoldenSpear opened this issue May 24, 2022 · 3 comments
Open

Question: only states and events (no side effects) #53

Dario-GoldenSpear opened this issue May 24, 2022 · 3 comments

Comments

@Dario-GoldenSpear
Copy link

Dario-GoldenSpear commented May 24, 2022

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.

@dave08
Copy link

dave08 commented Aug 21, 2022

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....)

@Dario-GoldenSpear
Copy link
Author

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.

@felixwiemuth
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants