@@ -24,9 +24,9 @@ module Asyncly.AsyncT
24 , interleave
24 , interleave
26 , parAhead
26 , parAhead
30 , foldWith
30 , foldWith
31 , foldMapWith
31 , foldMapWith
32 , forEachWith
32 , forEachWith
@@ -418,17 +418,19 @@ instance MonadAsync m => Alternative (AsyncT m) where
418 queueWork c m1 >> queueWork c m2
418 queueWork c m1 >> queueWork c m2
419 (runAsyncT (dequeueLoop c)) Nothing stp yld
419 (runAsyncT (dequeueLoop c)) Nothing stp yld
421+-- | Just like '<>' except that it can execute the action on the right in
421−-- | Run actions in parallel but return the results in serial order from left
422+-- parallel ahead of time. Returns the results in serial order like '<>' from
422−-- to right.
423+-- left to right.
423parAhead :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
424parAhead :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
424parAhead = undefined
425parAhead = undefined
426−(<>>) :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
427+(<>|) :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
427−(<>>) = parAhead
428+(<>|) = parAhead
429−-- | Left biased parallel execution. Actions are run in parallel but the
430+-- | Left biased parallel execution. Actions may run in parallel but not
430−-- the actions on the left are likely to be executed before those on
431+-- necessarily, the action on the left is executed before the one on the right
431−-- the right. This combinator is useful when fairness is not required.
432+-- when parallelism is not needed. This combinator is useful when fairness is
432{-# INLINE parLeft #-}
434{-# INLINE parLeft #-}
433parLeft :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
435parLeft :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
434parLeft m1 m2 = AsyncT $ \ctx stp yld -> do
436parLeft m1 m2 = AsyncT $ \ctx stp yld -> do
@@ -442,9 +444,9 @@ parLeft m1 m2 = AsyncT $ \ctx stp yld -> do
442 (runAsyncT (dequeueLoop c)) Nothing stp yld
444 (runAsyncT (dequeueLoop c)) Nothing stp yld
444-- | Same as 'parLeft'.
446-- | Same as 'parLeft'.
445−{-# INLINE (|>) #-}
447+{-# INLINE (<|) #-}
446−(|>) :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
448+(<|) :: MonadAsync m => AsyncT m a -> AsyncT m a -> AsyncT m a
447−(|>) = parLeft
449+(<|) = parLeft
449instance MonadAsync m => MonadPlus (AsyncT m) where
451instance MonadAsync m => MonadPlus (AsyncT m) where
450 mzero = empty
452 mzero = empty