@@ -9,7 +9,7 @@ module Strands.Threads
99 , sync
1010 --, react
1111 , threads
12− , waitAsync
12+ , gather
1313 )
1414where
1515
@@ -538,13 +538,14 @@ finishComputation x = AsyncT $ do
538538 collectResult x
539539 return Nothing
540540
541−-- XXX pass a collector function and return a Traversable.
542−-- XXX Ideally it should be a non-empty list instead.
543−-- | Run an 'AsyncT m' computation. Returns a list of results of the
544−-- computation or may throw an exception.
545−waitAsync :: forall m a. (MonadIO m, MonadCatch m)
541+-- XXX pass a collector function and return a Traversable?
542+-- XXX Ideally it should be a non-empty list.
543+
544+-- | Run an 'AsyncT m' computation and collect the results generated by each
545+-- thread of the computation in a list.
546+gather :: forall m a. (MonadIO m, MonadCatch m)
546547 => AsyncT m a -> m [a]
547−waitAsync m = do
548+gather m = do
548549 childChan <- liftIO $ atomically newTChan
549550 pendingRef <- liftIO $ newIORef []
550551 resultsRef <- liftIO $ newIORef []