@@ -109,6 +109,7 @@ module Streamly.Internal.Data.Unfold
109 -- * Zipping
109 -- * Zipping
110 , zipWithM
110 , zipWithM
111 , zipWith
111 , zipWith
113 -- * Nesting
114 -- * Nesting
@@ -590,6 +591,16 @@ zipWith :: Monad m
590 => (a -> b -> c) -> Unfold m x a -> Unfold m y b -> Unfold m (x, y) c
591 => (a -> b -> c) -> Unfold m x a -> Unfold m y b -> Unfold m (x, y) c
591zipWith f = zipWithM (\a b -> return (f a b))
592zipWith f = zipWithM (\a b -> return (f a b))
594+-- | Distribute the input to two unfolds and then zip the outputs to a single
599+{-# INLINE_NORMAL teeZipWith #-}
600+teeZipWith :: Monad m
601+ => (a -> b -> c) -> Unfold m x a -> Unfold m x b -> Unfold m x c
602+teeZipWith f unf1 unf2 = lmap (\x -> (x,x)) $ zipWith f unf1 unf2
593-------------------------------------------------------------------------------
604-------------------------------------------------------------------------------
595-------------------------------------------------------------------------------
606-------------------------------------------------------------------------------