@@ -586,6 +586,18 @@ zipWithM f (Unfold step1 inject1) (Unfold step2 inject2) = Unfold step inject
586 Skip s -> return $ Skip (s1, s, Just x)
586 Skip s -> return $ Skip (s1, s, Just x)
587 Stop -> return Stop
587 Stop -> return Stop
589+-- | Divide the input into two unfolds and then zip the outputs to a single
594+-- $ S.concatUnfold (UF.zipWith (,) UF.identity (UF.singleton sqrt))
595+-- $ S.map (\x -> (x,x))
596+-- $ S.fromList [1..10]
589{-# INLINE zipWith #-}
601{-# INLINE zipWith #-}
590zipWith :: Monad m
602zipWith :: Monad m
591 => (a -> b -> c) -> Unfold m x a -> Unfold m y b -> Unfold m (x, y) c
603 => (a -> b -> c) -> Unfold m x a -> Unfold m y b -> Unfold m (x, y) c
@@ -594,6 +606,10 @@ zipWith f = zipWithM (\a b -> return (f a b))
594-- | Distribute the input to two unfolds and then zip the outputs to a single
606-- | Distribute the input to two unfolds and then zip the outputs to a single
595-- stream.
607-- stream.
610+-- S.mapM_ print $ S.concatUnfold (UF.teeZipWith (,) UF.identity (UF.singleton sqrt)) $ S.fromList [1..10]
597-- /Internal/
613-- /Internal/
599{-# INLINE_NORMAL teeZipWith #-}
615{-# INLINE_NORMAL teeZipWith #-}