When composing multiple streams using concurrent combinators like async, ahead or parallel we stop a thread midway in the stream if we find that the buffer is full. When we resume the stream later we start using a fresh monadic state from the SVar (svarMrun), at this point we have lost the state of the stream as it was when the stream stopped and we are now using incorrect state.
To resolve this we can either block the thread instead of stopping it or we can capture the state of the stream and store it along with the stream in the workqueue.
When composing multiple streams using concurrent combinators like
async,aheadorparallelwe stop a thread midway in the stream if we find that the buffer is full. When we resume the stream later we start using a fresh monadic state from the SVar (svarMrun), at this point we have lost the state of the stream as it was when the stream stopped and we are now using incorrect state.To resolve this we can either block the thread instead of stopping it or we can capture the state of the stream and store it along with the stream in the workqueue.