@@ -29,7 +29,6 @@ import Control.Monad.IO.Class (MonadIO(..))
29import Control.Monad.State.Strict (StateT, get, put)
29import Control.Monad.State.Strict (StateT, get, put)
30import Data.Functor.Identity (Identity, runIdentity)
30import Data.Functor.Identity (Identity, runIdentity)
31import Data.IORef (newIORef, modifyIORef')
31import Data.IORef (newIORef, modifyIORef')
32−import Data.Maybe (fromJust)
33import GHC.Generics (Generic)
32import GHC.Generics (Generic)
34import Prelude
33import Prelude
35 (Monad, Int, (+), ($), (.), return, fmap, even, (>), (<=), (==), (>=),
34 (Monad, Int, (+), ($), (.), return, fmap, even, (>), (<=), (==), (>=),
@@ -718,25 +717,32 @@ inspect $ 'zipM `hasNoType` ''D.Step
720{-# INLINE zipAsync #-}
719{-# INLINE zipAsync #-}
720+zipAsync :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
721+zipAsync count n = do
723+ (sourceUnfoldrMN count n)
724+ (sourceUnfoldrMN count (n + 1))
721{-# INLINE zipAsyncM #-}
726{-# INLINE zipAsyncM #-}
727+zipAsyncM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
728+zipAsyncM count n = do
729+ S.zipAsyncWithM (curry return)
730+ (sourceUnfoldrMN count n)
731+ (sourceUnfoldrMN count (n + 1))
722{-# INLINE zipAsyncAp #-}
733{-# INLINE zipAsyncAp #-}
723−zipAsync, zipAsyncAp, zipAsyncM :: S.MonadAsync m => Stream m Int -> m ()
734+zipAsyncAp :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
727− let src1 = fromJust r
728− transform (S.zipAsyncWith (,) src src1)
732− let src1 = fromJust r
733− transform (S.zipAsyncWithM (curry return) src src1)
735−zipAsyncAp src = do
735+zipAsyncAp count n = do
737− let src1 = fromJust r
738− transform (S.zipAsyncly $ (,) <$> S.serially src
736+ S.zipAsyncly $ (,)
739− <*> S.serially src1)
737+ <$> (sourceUnfoldrMN count n)
738+ <*> (sourceUnfoldrMN count (n + 1))
740+{-# INLINE mergeAsyncByM #-}
741+mergeAsyncByM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m Int
742+mergeAsyncByM count n = do
743+ S.mergeAsyncByM (\a b -> return (a `compare` b))
744+ (sourceUnfoldrMN count n)
745+ (sourceUnfoldrMN count (n + 1))
741-------------------------------------------------------------------------------
747-------------------------------------------------------------------------------
742-- Multi-stream folds
748-- Multi-stream folds