on master help sign in
Export the async API
commite75a12d4fae0f87b5acd1a455a01db8b110bf94b authorHarendra Kumar <harendra.kumar@gmail.com> dateSat 14 Oct 2017, 21:32 (9 years ago) parent50e1604
2 files changed+7
src/Asyncly.hs+1 src/Asyncly/AsyncT.hs+6
src/Asyncly.hs+1
@@ -126,6 +126,7 @@ module Asyncly
126126 -- * Running
127127 , runAsyncly
128128 , toList
129+ , async
129130
130131 -- * Monadic Composition (Conjunction)
131132 -- $bind
src/Asyncly/AsyncT.hs+6
@@ -22,8 +22,11 @@ module Asyncly.AsyncT
2222 , MonadAsync
2323 , runAsyncly
2424 , toList
25+ , async
26+
2527 , take
2628 , drop
29+
2730 , zipWithM
2831 , zipWith
2932 , ZipSerial (..)
@@ -768,6 +771,9 @@ pushOneToCtx ctype m = do
768771 pushWorker ctx
769772 return ctx
770773
774+-- | Run a computation asynchronously, triggers the computation and returns
775+-- another computation (i.e. a promise) that when run produces the output from
776+-- the original computation.
771777async :: MonadAsync m => AsyncT m a -> m (AsyncT m a)
772778async m = do
773779 ctx <- pushOneToCtx (CtxType Disjunction LIFO) m