@@ -12,12 +12,12 @@ module Strands.Threads
19 , waitLogged
19 , waitLogged
20− , gatherLogged
20+ , waitLogged_
22 , eachWithLog
22 , eachWithLog
@@ -539,18 +539,16 @@ gatherResult ref r = do
540-- | Run an 'AsyncT m' computation and collect the results generated by each
540-- | Run an 'AsyncT m' computation and collect the results generated by each
541-- thread of the computation in a list.
541-- thread of the computation in a list.
542−gather :: forall m a. (MonadIO m, MonadCatch m)
542+wait :: (MonadIO m, MonadCatch m) => AsyncT m a -> m [a]
543− => AsyncT m a -> m [a]
543+wait m = do
545 resultsRef <- liftIO $ newIORef []
544 resultsRef <- liftIO $ newIORef []
546 waitAsync (gatherResult resultsRef) Nothing m
545 waitAsync (gatherResult resultsRef) Nothing m
547 liftIO $ readIORef resultsRef
546 liftIO $ readIORef resultsRef
549-- | Run an 'AsyncT m' computation, wait for it to finish and discard the
548-- | Run an 'AsyncT m' computation, wait for it to finish and discard the
550-- results.
549-- results.
551−wait :: forall m a. (MonadIO m, MonadCatch m)
550+wait_ :: (MonadIO m, MonadCatch m) => AsyncT m a -> m ()
552− => AsyncT m a -> m ()
553−wait m = waitAsync (const mzero) Nothing m
551+wait_ m = waitAsync (const mzero) Nothing m
555------------------------------------------------------------------------------
553------------------------------------------------------------------------------
556-- Logging
554-- Logging
@@ -636,8 +634,8 @@ eachWithLog m logs = each logs >>= withLog m
637-- | Run an 'AsyncT m' computation with logging enabled and collect the results
635-- | Run an 'AsyncT m' computation with logging enabled and collect the results
638-- or logs generated by each thread of the computation.
636-- or logs generated by each thread of the computation.
639−gatherLogged :: (MonadIO m, MonadCatch m) => AsyncT m a -> m ([a], [Log])
637+waitLogged :: (MonadIO m, MonadCatch m) => AsyncT m a -> m ([a], [Log])
640−gatherLogged m = do
638+waitLogged m = do
641 resultsRef <- liftIO $ newIORef []
639 resultsRef <- liftIO $ newIORef []
642 lref <- liftIO $ newIORef []
640 lref <- liftIO $ newIORef []
643 waitAsync (gatherResult resultsRef) (Just lref) m
641 waitAsync (gatherResult resultsRef) (Just lref) m
@@ -648,8 +646,8 @@ gatherLogged m = do
648-- | Run an 'AsyncT m' computation with logging enabled, wait for it to finish
646-- | Run an 'AsyncT m' computation with logging enabled, wait for it to finish
649-- and discard the results. If the computation suspends collect the logs to
647-- and discard the results. If the computation suspends collect the logs to
650-- replay later.
648-- replay later.
651−waitLogged :: (MonadIO m, MonadCatch m) => AsyncT m a -> m [Log]
649+waitLogged_ :: (MonadIO m, MonadCatch m) => AsyncT m a -> m [Log]
652−waitLogged m = do
650+waitLogged_ m = do
653 lref <- liftIO $ newIORef []
651 lref <- liftIO $ newIORef []
654 waitAsync (const mzero) (Just lref) m
652 waitAsync (const mzero) (Just lref) m
655 logs <- liftIO $ readIORef lref
653 logs <- liftIO $ readIORef lref