I need to start several simultaneous processes in the context of the same monad, say Connection . I was expecting something like the following to work:
main = runConnection connectionSettings $ do forkIO action1 forkIO action2 action3
but forkIO needs to be run in the context of IO and the actions that should be in IO too.
Assuming these actions are of type :: Connection () , what needs to be done to run them simultaneously (which instances to implement, etc.)?
I am currently working on this as follows, but obviously this is wrong:
main = do forkIO $ runConnection connectionSettings action1 forkIO $ runConnection connectionSettings action2 runConnection connectionSettings action3
source share