@@ -92,8 +92,9 @@ runAsynclyLogged lref m = do
94 stop = return ()
94 stop = return ()
95− run ct mx = (runAsyncT mx) ct stop (\_ ct r ->
95+ {-# INLINE yield #-}
96− maybe stop (\x -> (run ct x)) r)
96+ yield _ c r = maybe stop (\x -> (run c x)) r
97+ run ct mx = (runAsyncT mx) ct stop yield
98runAsyncly :: MonadAsync m => AsynclyT m a -> m ()
99runAsyncly :: MonadAsync m => AsynclyT m a -> m ()
99runAsyncly m = runAsynclyLogged Nothing m
100runAsyncly m = runAsynclyLogged Nothing m
@@ -110,17 +111,13 @@ toList m = do
113− stop = return Stop
114+ stop = return []
114− done a = return (Done a)
115+ done a = return [a]
115− yield a c x = return $ Yield a c x
116+ {-# INLINE yield #-}
118− res <- (runAsyncT ma) ctx stop (\a c r ->
119− maybe (done a) (\x -> yield a c x) r)
117+ yield a c r = maybe (done a) (\x -> liftM (a :) (run c x)) r
121− Yield x c mb -> liftM (x :) (run c mb)
119+ {-# INLINE run #-}
122− Stop -> return []
120+ run ctx mx = (runAsyncT mx) ctx stop yield
123− Done x -> return (x : [])
125{-# INLINABLE each #-}
122{-# INLINABLE each #-}
126each :: MonadAsync m => [a] -> AsynclyT m a
123each :: MonadAsync m => [a] -> AsynclyT m a