-- | 'spawn' runs an IO action in a separate thread.
-- If an action throws an exception it will be rethrown to parent thread.
spawn :: IO () -> IO ThreadId
spawn act = do
    tId <- myThreadId
    forkIO $ act `catch` throwTo tId
spawn :: IO () -> IO ThreadId
spawn act = do
    tId <- myThreadId
    forkIO $ act `catch` throwTo tId
spawn act = do
    tId <- myThreadId
    forkIO $ act `catch` throwTo tId