on master help sign in
Export the async API
e75a12dHarendra Kumar
src/Asyncly.hs+1
@@ -126,6 +126,7 @@ module Asyncly
126 -- * Running
126 -- * Running
127 , runAsyncly
127 , runAsyncly
128 , toList
128 , toList
129+ , async
129
130
130 -- * Monadic Composition (Conjunction)
131 -- * Monadic Composition (Conjunction)
131 -- $bind
132 -- $bind
src/Asyncly/AsyncT.hs+6
@@ -22,8 +22,11 @@ module Asyncly.AsyncT
22 , MonadAsync
22 , MonadAsync
23 , runAsyncly
23 , runAsyncly
24 , toList
24 , toList
25+ , async
26+
25 , take
27 , take
26 , drop
28 , drop
29+
27 , zipWithM
30 , zipWithM
28 , zipWith
31 , zipWith
29 , ZipSerial (..)
32 , ZipSerial (..)
@@ -768,6 +771,9 @@ pushOneToCtx ctype m = do
768 pushWorker ctx
771 pushWorker ctx
769 return ctx
772 return ctx
770
773
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.
771async :: MonadAsync m => AsyncT m a -> m (AsyncT m a)
777async :: MonadAsync m => AsyncT m a -> m (AsyncT m a)
772async m = do
778async m = do
773 ctx <- pushOneToCtx (CtxType Disjunction LIFO) m
779 ctx <- pushOneToCtx (CtxType Disjunction LIFO) m