> If your program has state, it doesn't matter if it's mutable or immutable state, you will still run into the same problems when working with concurrency. You either have to use locks, make sure functions are executed in the right order, or the preferred way: designate/central state.
What about using STM:
https://www.fpcomplete.com/school/advanced-haskell/beautiful...