Use concurrent Action () pipes which feed into the same mailbox for async actions; the main event loop keeps pulling events from the mailbox and runs them synchronously.
A little less clean, not sure how I feel about carrying the Output along in the state monad (technically it should be in a ReaderT, but that just complicates the monad stack) but it should cut it down to one persistent thread per event provider/async action.
Use concurrent
Action ()
pipes which feed into the same mailbox for async actions; the main event loop keeps pulling events from the mailbox and runs them synchronously.A little less clean, not sure how I feel about carrying the Output along in the state monad (technically it should be in a ReaderT, but that just complicates the monad stack) but it should cut it down to one persistent thread per event provider/async action.
Let me know what you all think!