@@ -424,12 +424,12 @@ pullWorker ctx = AsyncT $ \_ stp yld -> do
424424
425425-- | Split the original computation in a pull-push pair. The original
426426-- computation pulls from a Channel while m1 and m2 push to the channel.
427−{-# NOINLINE pullFork #-}
428−pullFork :: MonadAsync m
429− => CtxType -> AsyncT m a -> AsyncT m a -> AsyncT m a
430−pullFork ct m1 m2 = AsyncT $ \_ stp yld -> do
427+pullForkPush :: MonadAsync m
428+ => CtxType -> AsyncT m a -> AsyncT m a -> m (Context m a)
429+pullForkPush ct m1 m2 = do
431430 ctx <- liftIO $ newContext
432− pushWorker ctx >> (runAsyncT (pullWorker ctx)) Nothing stp yld
431+ pushWorker ctx
432+ return ctx
433433
434434 where
435435
@@ -467,6 +467,17 @@ pullFork ct m1 m2 = AsyncT $ \_ stp yld -> do
467467 }
468468 in return ctx
469469
470+pullForkPull :: MonadAsync m => Context m a -> AsyncT m a
471+pullForkPull ctx = AsyncT $ \_ stp yld ->
472+ (runAsyncT (pullWorker ctx)) Nothing stp yld
473+
474+{-# NOINLINE pullFork #-}
475+pullFork :: MonadAsync m
476+ => CtxType -> AsyncT m a -> AsyncT m a -> AsyncT m a
477+pullFork ct m1 m2 = AsyncT $ \_ stp yld -> do
478+ ctx <- pullForkPush ct m1 m2
479+ (runAsyncT (pullForkPull ctx)) Nothing stp yld
480+
470481-- Concurrency rate control. Our objective is to create more threads on
471482-- demand if the consumer is running faster than us. As soon as we
472483-- encounter an Alternative composition we create a push pull pair of