-- Private Types --------------------------------------------------------------
-- Private Functions ----------------------------------------------------------

{- |
  Kicks off an IO in a new thread
-}
async :: IO a -> IO (MVar (Either SomeException a))
async io = do
  job <- newEmptyMVar
  forkIO $ do
    result <- try io
    putMVar job result
  return job


-- Tests ----------------------------------------------------------------------
async :: IO a -> IO (MVar (Either SomeException a))
async io = do
  job <- newEmptyMVar
  forkIO $ do
    result <- try io
    putMVar job result
  return job


-- Tests ----------------------------------------------------------------------
async io = do
  job <- newEmptyMVar
  forkIO $ do
    result <- try io
    putMVar job result
  return job


-- Tests ----------------------------------------------------------------------