You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To support concurrent modification of shared state we need a concurrent StateT. A concurrent StateT would fork the shared state to multiple concurrent threads and then join the modified state back to create a common modified shared state. We can have fork and join typeclasses to facilitate the forking an combining of state.
In addition to StateT, ExceptT is another candidate for fork and join of state.
Instead of using fork/join typeclasses we can have a Monoid instance on the state of the monad and combine the states of the concurrent actions on completion.
Currently the MonadState instance for concurrent streams is broken. We should either fix this issue or remove that instance. Marking this issue as a bug because of that.
MonadState is broken for concurrent streams in Streamly.Prelude but we are deprecating that module in 0.9.0 and now we have explicit concurrency via Data.Stream.Concurrent, so we are leaving MonadState for old streams as is.
Activity
harendra-kumar commentedon Jun 20, 2020
Instead of using fork/join typeclasses we can have a
Monoidinstance on the state of the monad and combine the states of the concurrent actions on completion.Currently the
MonadStateinstance for concurrent streams is broken. We should either fix this issue or remove that instance. Marking this issue as a bug because of that.harendra-kumar commentedon Oct 18, 2022
MonadState is broken for concurrent streams in Streamly.Prelude but we are deprecating that module in 0.9.0 and now we have explicit concurrency via Data.Stream.Concurrent, so we are leaving MonadState for old streams as is.