@@ -14,7 +14,7 @@
1414module Streamly.Internal.Data.Stream.IsStream.Common
1515 (
1616 -- * Generation
17− yield
17+ fromPure
1818 , yieldM
1919 , repeatM
2020 , timesWith
@@ -44,6 +44,9 @@ module Streamly.Internal.Data.Stream.IsStream.Common
4444 , concatMapM
4545 , concatMap
4646 , splitOnSeq
47+
48+ -- * Deprecated
49+ , yield
4750 )
4851where
4952
@@ -92,7 +95,7 @@ import Prelude hiding (take, takeWhile, drop, reverse, concatMap)
9295--
9396-- |
9497-- @
95−-- yield a = a \`cons` nil
98+-- fromPure a = a \`cons` nil
9699-- @
97100--
98101-- Create a singleton stream from a pure value.
@@ -100,19 +103,20 @@ import Prelude hiding (take, takeWhile, drop, reverse, concatMap)
100103-- The following holds in monadic streams, but not in Zip streams:
101104--
102105-- @
103−-- yield = pure
104−-- yield = yieldM . pure
106+-- fromPure = pure
107+-- fromPure = yieldM . pure
105108-- @
106109--
107−-- In Zip applicative streams 'yield' is not the same as 'pure' because in that
108−-- case 'pure' is equivalent to 'repeat' instead. 'yield' and 'pure' are
109−-- equally efficient, in other cases 'yield' may be slightly more efficient
110+-- In Zip applicative streams 'fromPure' is not the same as 'pure' because in that
111+-- case 'pure' is equivalent to 'repeat' instead. 'fromPure' and 'pure' are
112+-- equally efficient, in other cases 'fromPure' may be slightly more efficient
110113-- than the other equivalent definitions.
111114--
112−-- @since 0.4.0
113−{-# INLINE yield #-}
114−yield :: IsStream t => a -> t m a
115−yield = K.yield
115+-- /Since: 0.8.0 (Renamed yield to fromPure)/
116+--
117+{-# INLINE fromPure #-}
118+fromPure :: IsStream t => a -> t m a
119+fromPure = K.fromPure
116120
117121-- |
118122-- @
@@ -484,7 +488,7 @@ concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
484488--
485489{-# INLINE concatM #-}
486490concatM :: (IsStream t, Monad m) => m (t m a) -> t m a
487−concatM generator = concatMapM (\() -> generator) (yield ())
491+concatM generator = concatMapM (\() -> generator) (fromPure ())
488492
489493------------------------------------------------------------------------------
490494-- Split stream and fold
@@ -545,3 +549,11 @@ splitOnSeq
545549 :: (IsStream t, MonadIO m, Storable a, Enum a, Eq a)
546550 => Array a -> Fold m a b -> t m a -> t m b
547551splitOnSeq patt f m = D.fromStreamD $ D.splitOnSeq patt f (D.toStreamD m)
552+
553+-- | Same as 'yield'
554+--
555+-- @since 0.4.0
556+{-# DEPRECATED yield "Please use fromPure instead." #-}
557+{-# INLINE yield #-}
558+yield :: IsStream t => a -> t m a
559+yield = fromPure