
18 Jan
2014
18 Jan
'14
10:26 a.m.
E.g. https://hackage.haskell.org/package/async ? On Sat 18 Jan 2014 15:18:20 GMT, Tristan Seligmann wrote:
I was wondering if a standard implementation of these helpers (or something similar) existed somewhere:
startAsync :: IO a -> IO (MVar a) startAsync action = do var <- newEmptyMVar forkIO $ action >>= putMVar var return var
wait :: MVar a -> IO a wait = readMVar
I've found a few throwaway examples that implement something similar, and I can imagine some improvements already (I guess the MVar should be wrapped, for example, and some higher) but I was unable to find any released library that does something like this.
Is it just too trivial for anyone to have bothered?