This article is quite good at explaining: https://wickstrom.tech/2017-11-10-finite-state-machines-part-1-modeling-with-haskell.html
Don't get hung up on the language though. Anyway, using something like this may help how you structure your code.
This article is quite good at explaining: https://wickstrom.tech/2017-11-10-finite-state-machines-part-1-modeling-with-haskell.html
Don't get hung up on the language though. Anyway, using something like this may help how you structure your code.
followed