@@ -750,10 +750,12 @@ mapMaybe f = go
750-- | Zip two streams serially using a pure zipping function.
750-- | Zip two streams serially using a pure zipping function.
752-- @since 0.1.0
752-- @since 0.1.0
753−{-# INLINABLE zipWith #-}
753+{-# INLINE zipWith #-}
754zipWith :: (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
754zipWith :: (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
755zipWith f = go
755zipWith f = go
757 go mx my = mkStream $ \st yld sng stp -> do
759 go mx my = mkStream $ \st yld sng stp -> do
758 let merge a ra =
760 let merge a ra =
759 let single2 b = sng (f a b)
761 let single2 b = sng (f a b)
@@ -766,16 +768,17 @@ zipWith f = go
766-- | Zip two streams serially using a monadic zipping function.
768-- | Zip two streams serially using a monadic zipping function.
768-- @since 0.1.0
770-- @since 0.1.0
769−{-# INLINABLE zipWithM #-}
771+{-# INLINE zipWithM #-}
770zipWithM :: Monad m =>
772zipWithM :: Monad m =>
771 (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c
773 (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c
772zipWithM f = go
774zipWithM f = go
774 go mx my = mkStream $ \st yld sng stp -> do
778 go mx my = mkStream $ \st yld sng stp -> do
775 let merge a ra =
779 let merge a ra =
776− let runIt x = foldStream st yld sng stp x
777− single2 b = f a b >>= sng
780+ let single2 b = f a b >>= sng
778− yield2 b rb = f a b >>= \x -> runIt (x `cons` go ra rb)
781+ yield2 b rb = f a b >>= \x -> yld x (go ra rb)
779 in foldStream (adaptState st) yield2 single2 stp my
782 in foldStream (adaptState st) yield2 single2 stp my
780 let single1 a = merge a nil
783 let single1 a = merge a nil
781 yield1 = merge
784 yield1 = merge