@@ -50,7 +50,8 @@ module Streamly.Streams
50 , InterleavedT
50 , InterleavedT
52 , ParallelT
52 , ParallelT
53− , ZipStream
54+ , ZipStream -- deprecated
54 , ZipAsync
55 , ZipAsync
56 -- * Type Adapters
57 -- * Type Adapters
@@ -68,7 +69,8 @@ module Streamly.Streams
68 , runInterleavedT
69 , runInterleavedT
69 , runAsyncT
70 , runAsyncT
70 , runParallelT
71 , runParallelT
71− , runZipStream
73+ , runZipStream -- deprecated
72 , runZipAsync
74 , runZipAsync
74 -- * Zipping
76 -- * Zipping
@@ -728,10 +730,10 @@ zipWith f m1 m2 = fromStream $ go (toStream m1) (toStream m2)
728 yield1 a (Just ra) = merge a ra
730 yield1 a (Just ra) = merge a ra
729 (runStream mx) Nothing stp yield1
731 (runStream mx) Nothing stp yield1
731−-- | The applicative instance of 'ZipStream' zips a number of streams serially
733+-- | The applicative instance of 'ZipSerial' zips a number of streams serially
732-- i.e. it produces one element from each stream serially and then zips all
734-- i.e. it produces one element from each stream serially and then zips all
733-- those elements. Note, for convenience we have used the 'zipping' combinator
735-- those elements. Note, for convenience we have used the 'zipping' combinator
734−-- in the following example instead of using a 'ZipStream' type annotation.
736+-- in the following example instead of using a 'ZipSerial' type annotation.
737-- main = (toList . 'zipping' $ (,,) \<$\> s1 \<*\> s2 \<*\> s3) >>= print
739-- main = (toList . 'zipping' $ (,,) \<$\> s1 \<*\> s2 \<*\> s3) >>= print
@@ -745,27 +747,31 @@ zipWith f m1 m2 = fromStream $ go (toStream m1) (toStream m2)
746-- This applicative operation can be seen as the zipping equivalent of
748-- This applicative operation can be seen as the zipping equivalent of
747-- interleaving with '<=>'.
749-- interleaving with '<=>'.
748−newtype ZipStream m a = ZipStream {getZipStream :: Stream m a}
750+newtype ZipSerial m a = ZipSerial {getZipSerial :: Stream m a}
749 deriving (Semigroup, Monoid)
751 deriving (Semigroup, Monoid)
751−deriving instance MonadAsync m => Alternative (ZipStream m)
753+{-# Deprecated ZipStream "Please use ZipSerial instead." #-}
754+-- | Same as ZipSerial.
755+type ZipStream = ZipSerial
757+deriving instance MonadAsync m => Alternative (ZipSerial m)
753−instance Monad m => Functor (ZipStream m) where
759+instance Monad m => Functor (ZipSerial m) where
754− fmap f (ZipStream (Stream m)) = ZipStream $ Stream $ \_ stp yld ->
760+ fmap f (ZipSerial (Stream m)) = ZipSerial $ Stream $ \_ stp yld ->
755 let yield a Nothing = yld (f a) Nothing
761 let yield a Nothing = yld (f a) Nothing
756 yield a (Just r) = yld (f a)
762 yield a (Just r) = yld (f a)
757− (Just (getZipStream (fmap f (ZipStream r))))
763+ (Just (getZipSerial (fmap f (ZipSerial r))))
758 in m Nothing stp yield
764 in m Nothing stp yield
760−instance Monad m => Applicative (ZipStream m) where
766+instance Monad m => Applicative (ZipSerial m) where
761− pure = ZipStream . srepeat
767+ pure = ZipSerial . srepeat
762 (<*>) = zipWith id
768 (<*>) = zipWith id
764−instance Streaming ZipStream where
770+instance Streaming ZipSerial where
765− toStream = getZipStream
771+ toStream = getZipSerial
766− fromStream = ZipStream
772+ fromStream = ZipSerial
768−instance (Monad m, Num a) => Num (ZipStream m a) where
774+instance (Monad m, Num a) => Num (ZipSerial m a) where
769 fromInteger n = pure (fromInteger n)
775 fromInteger n = pure (fromInteger n)
771 negate = fmap negate
777 negate = fmap negate
@@ -776,14 +782,14 @@ instance (Monad m, Num a) => Num (ZipStream m a) where
776 (*) = liftA2 (*)
782 (*) = liftA2 (*)
777 (-) = liftA2 (-)
783 (-) = liftA2 (-)
779−instance (Monad m, Fractional a) => Fractional (ZipStream m a) where
785+instance (Monad m, Fractional a) => Fractional (ZipSerial m a) where
780 fromRational n = pure (fromRational n)
786 fromRational n = pure (fromRational n)
782 recip = fmap recip
788 recip = fmap recip
784 (/) = liftA2 (/)
790 (/) = liftA2 (/)
786−instance (Monad m, Floating a) => Floating (ZipStream m a) where
792+instance (Monad m, Floating a) => Floating (ZipSerial m a) where
787 pi = pure pi
793 pi = pure pi
789 exp = fmap exp
795 exp = fmap exp
@@ -818,7 +824,7 @@ zipAsyncWith f m1 m2 = fromStream $ Stream $ \_ stp yld -> do
818 mb <- async m2
824 mb <- async m2
819 (runStream (toStream (zipWith f ma mb))) Nothing stp yld
825 (runStream (toStream (zipWith f ma mb))) Nothing stp yld
821−-- | Like 'ZipStream' but zips in parallel, it generates all the elements to
827+-- | Like 'ZipSerial' but zips in parallel, it generates all the elements to
822-- be zipped concurrently.
828-- be zipped concurrently.
@@ -917,8 +923,8 @@ asyncly x = x
917parallely :: ParallelT m a -> ParallelT m a
923parallely :: ParallelT m a -> ParallelT m a
918parallely x = x
924parallely x = x
920−-- | Interpret an ambiguously typed stream as 'ZipStream'.
926+-- | Interpret an ambiguously typed stream as 'ZipSerial'.
921−zipping :: ZipStream m a -> ZipStream m a
927+zipping :: ZipSerial m a -> ZipSerial m a
922zipping x = x
928zipping x = x
924-- | Interpret an ambiguously typed stream as 'ZipAsync'.
930-- | Interpret an ambiguously typed stream as 'ZipAsync'.
@@ -936,7 +942,7 @@ runSerialT = runStreaming
936-- | Same as @runSerialT@.
942-- | Same as @runSerialT@.
937{-# Deprecated runStreamT "Please use runSerialT instead." #-}
943{-# Deprecated runStreamT "Please use runSerialT instead." #-}
938runStreamT :: Monad m => SerialT m a -> m ()
944runStreamT :: Monad m => SerialT m a -> m ()
939−runStreamT = runStreaming
945+runStreamT = runSerialT
941-- | Same as @runStreaming . interleaving@.
947-- | Same as @runStreaming . interleaving@.
942runInterleavedT :: Monad m => InterleavedT m a -> m ()
948runInterleavedT :: Monad m => InterleavedT m a -> m ()
@@ -951,8 +957,13 @@ runParallelT :: Monad m => ParallelT m a -> m ()
951runParallelT = runStreaming
957runParallelT = runStreaming
953-- | Same as @runStreaming . zipping@.
959-- | Same as @runStreaming . zipping@.
954−runZipStream :: Monad m => ZipStream m a -> m ()
960+runZipSerial :: Monad m => ZipSerial m a -> m ()
955−runZipStream = runStreaming
961+runZipSerial = runStreaming
963+{-# Deprecated runZipStream "Please use runZipSerial instead." #-}
964+-- | Same as ZipSerial.
965+runZipStream :: Monad m => ZipSerial m a -> m ()
966+runZipStream = runZipSerial
957-- | Same as @runStreaming . zippingAsync@.
968-- | Same as @runStreaming . zippingAsync@.
958runZipAsync :: Monad m => ZipAsync m a -> m ()
969runZipAsync :: Monad m => ZipAsync m a -> m ()