[Haskell-cafe] Standard implementation of asynchronous helpers?

Niklas Hambüchen mail at nh2.me
Sat Jan 18 15:26:51 UTC 2014


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?


More information about the Haskell-Cafe mailing list