@@ -14,7 +14,7 @@
14module Streamly.Internal.Data.Stream.IsStream.Common
14module Streamly.Internal.Data.Stream.IsStream.Common
16 -- * Generation
16 -- * Generation
20 , timesWith
20 , timesWith
@@ -44,6 +44,9 @@ module Streamly.Internal.Data.Stream.IsStream.Common
44 , concatMapM
44 , concatMapM
45 , concatMap
45 , concatMap
46 , splitOnSeq
46 , splitOnSeq
@@ -92,7 +95,7 @@ import Prelude hiding (take, takeWhile, drop, reverse, concatMap)
95−-- yield a = a \`cons` nil
98+-- fromPure a = a \`cons` nil
98-- Create a singleton stream from a pure value.
101-- Create a singleton stream from a pure value.
@@ -100,19 +103,20 @@ import Prelude hiding (take, takeWhile, drop, reverse, concatMap)
100-- The following holds in monadic streams, but not in Zip streams:
103-- The following holds in monadic streams, but not in Zip streams:
103−-- yield = pure
106+-- fromPure = pure
104−-- yield = yieldM . pure
107+-- fromPure = yieldM . pure
107−-- In Zip applicative streams 'yield' is not the same as 'pure' because in that
110+-- In Zip applicative streams 'fromPure' is not the same as 'pure' because in that
108−-- case 'pure' is equivalent to 'repeat' instead. 'yield' and 'pure' are
111+-- case 'pure' is equivalent to 'repeat' instead. 'fromPure' and 'pure' are
109−-- equally efficient, in other cases 'yield' may be slightly more efficient
112+-- equally efficient, in other cases 'fromPure' may be slightly more efficient
110-- than the other equivalent definitions.
113-- than the other equivalent definitions.
112−-- @since 0.4.0
115+-- /Since: 0.8.0 (Renamed yield to fromPure)/
113−{-# INLINE yield #-}
117+{-# INLINE fromPure #-}
114−yield :: IsStream t => a -> t m a
118+fromPure :: IsStream t => a -> t m a
115−yield = K.yield
119+fromPure = K.fromPure
@@ -484,7 +488,7 @@ concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
485{-# INLINE concatM #-}
489{-# INLINE concatM #-}
486concatM :: (IsStream t, Monad m) => m (t m a) -> t m a
490concatM :: (IsStream t, Monad m) => m (t m a) -> t m a
487−concatM generator = concatMapM (\() -> generator) (yield ())
491+concatM generator = concatMapM (\() -> generator) (fromPure ())
489------------------------------------------------------------------------------
493------------------------------------------------------------------------------
490-- Split stream and fold
494-- Split stream and fold
@@ -545,3 +549,11 @@ splitOnSeq
545 :: (IsStream t, MonadIO m, Storable a, Enum a, Eq a)
549 :: (IsStream t, MonadIO m, Storable a, Enum a, Eq a)
546 => Array a -> Fold m a b -> t m a -> t m b
550 => Array a -> Fold m a b -> t m a -> t m b
547splitOnSeq patt f m = D.fromStreamD $ D.splitOnSeq patt f (D.toStreamD m)
551splitOnSeq patt f m = D.fromStreamD $ D.splitOnSeq patt f (D.toStreamD m)
556+{-# DEPRECATED yield "Please use fromPure instead." #-}
558+yield :: IsStream t => a -> t m a