on master help sign in
Add since annotations on Streamly.Data.Stream module
301c0a3Ranjeet Kumar Ranjan
core/src/Streamly/Internal/Data/Stream/Bottom.hs+15−3
@@ -102,6 +102,7 @@ import Streamly.Internal.Data.Stream.Type
102-- Construct a stream from a list of pure values. This is more efficient than
102-- Construct a stream from a list of pure values. This is more efficient than
103-- 'fromFoldable'.
103-- 'fromFoldable'.
104--
104--
105+-- @since 0.9.0
105{-# INLINE fromList #-}
106{-# INLINE fromList #-}
106fromList :: Monad m => [a] -> Stream m a
107fromList :: Monad m => [a] -> Stream m a
107fromList = fromStreamK . Common.fromList
108fromList = fromStreamK . Common.fromList
@@ -183,7 +184,7 @@ relTimesWith = fmap snd . timesWith
183--
184--
184-- >>> fold f = Fold.finish . Stream.foldContinue f
185-- >>> fold f = Fold.finish . Stream.foldContinue f
185--
186--
186−-- /Internal/
187+-- @since 0.9.0
187{-# INLINE foldContinue #-}
188{-# INLINE foldContinue #-}
188foldContinue :: Monad m => Fold m a b -> Stream m a -> Fold m a b
189foldContinue :: Monad m => Fold m a b -> Stream m a -> Fold m a b
189foldContinue f s = D.foldContinue f $ toStreamD s
190foldContinue f s = D.foldContinue f $ toStreamD s
@@ -214,6 +215,7 @@ fold fl strm = D.fold fl $ D.fromStreamK $ toStreamK strm
214--
215--
215-- /Not fused/
216-- /Not fused/
216--
217--
218+-- @since 0.9.0
217{-# INLINE foldBreak #-}
219{-# INLINE foldBreak #-}
218foldBreak :: Monad m => Fold m a b -> Stream m a -> m (b, Stream m a)
220foldBreak :: Monad m => Fold m a b -> Stream m a -> m (b, Stream m a)
219{-
221{-
@@ -265,6 +267,7 @@ map f = fromStreamD . D.map f . toStreamD
265-- :}
267-- :}
266-- [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0]
268-- [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0]
267--
269--
270+-- @since 0.9.0
268{-# INLINE postscan #-}
271{-# INLINE postscan #-}
269postscan :: Monad m => Fold m a b -> Stream m a -> Stream m b
272postscan :: Monad m => Fold m a b -> Stream m a -> Stream m b
270postscan fld = fromStreamD . D.postscanOnce fld . toStreamD
273postscan fld = fromStreamD . D.postscanOnce fld . toStreamD
@@ -325,8 +328,7 @@ catMaybes = fromStreamD . D.catMaybes . toStreamD
325--
328--
326-- >>> scanMaybe f = Stream.catMaybes . Stream.postscan f
329-- >>> scanMaybe f = Stream.catMaybes . Stream.postscan f
327--
330--
328−-- /Pre-release/
331+-- @since 0.9.0
329−--
330{-# INLINE scanMaybe #-}
332{-# INLINE scanMaybe #-}
331scanMaybe :: Monad m => Fold m a (Maybe b) -> Stream m a -> Stream m b
333scanMaybe :: Monad m => Fold m a (Maybe b) -> Stream m a -> Stream m b
332scanMaybe p = catMaybes . postscan p
334scanMaybe p = catMaybes . postscan p
@@ -337,6 +339,7 @@ scanMaybe p = catMaybes . postscan p
337
339
338-- | Take first 'n' elements from the stream and discard the rest.
340-- | Take first 'n' elements from the stream and discard the rest.
339--
341--
342+-- @since 0.9.0
340{-# INLINE take #-}
343{-# INLINE take #-}
341take :: Monad m => Int -> Stream m a -> Stream m a
344take :: Monad m => Int -> Stream m a -> Stream m a
342-- take n = scanMaybe (Fold.taking n)
345-- take n = scanMaybe (Fold.taking n)
@@ -344,6 +347,7 @@ take n m = fromStreamD $ D.take n $ toStreamD m
344
347
345-- | End the stream as soon as the predicate fails on an element.
348-- | End the stream as soon as the predicate fails on an element.
346--
349--
350+-- @since 0.9.0
347{-# INLINE takeWhile #-}
351{-# INLINE takeWhile #-}
348takeWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a
352takeWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a
349-- takeWhile p = scanMaybe (Fold.takingEndBy_ (not . p))
353-- takeWhile p = scanMaybe (Fold.takingEndBy_ (not . p))
@@ -356,6 +360,7 @@ takeEndBy p m = fromStreamD $ D.takeEndBy p $ toStreamD m
356
360
357-- | Discard first 'n' elements from the stream and take the rest.
361-- | Discard first 'n' elements from the stream and take the rest.
358--
362--
363+-- @since 0.9.0
359{-# INLINE drop #-}
364{-# INLINE drop #-}
360drop :: Monad m => Int -> Stream m a -> Stream m a
365drop :: Monad m => Int -> Stream m a -> Stream m a
361-- drop n = scanMaybe (Fold.dropping n)
366-- drop n = scanMaybe (Fold.dropping n)
@@ -370,6 +375,7 @@ drop n m = fromStreamD $ D.drop n $ toStreamD m
370--
375--
371-- >>> findIndices p = Stream.fold (Fold.findIndices p)
376-- >>> findIndices p = Stream.fold (Fold.findIndices p)
372--
377--
378+-- @since 0.9.0
373{-# INLINE findIndices #-}
379{-# INLINE findIndices #-}
374findIndices :: Monad m => (a -> Bool) -> Stream m a -> Stream m Int
380findIndices :: Monad m => (a -> Bool) -> Stream m a -> Stream m Int
375-- findIndices p = scanMaybe (Fold.findIndices p)
381-- findIndices p = scanMaybe (Fold.findIndices p)
@@ -395,6 +401,7 @@ findIndices p m = fromStreamD $ D.findIndices p (toStreamD m)
395-- >>> Stream.fold Fold.toList $ Stream.intersperseM (putChar '.' >> return ',') $ Stream.trace putChar input
401-- >>> Stream.fold Fold.toList $ Stream.intersperseM (putChar '.' >> return ',') $ Stream.trace putChar input
396-- he.l.l.o."h,e,l,l,o"
402-- he.l.l.o."h,e,l,l,o"
397--
403--
404+-- @since 0.9.0
398{-# INLINE intersperseM #-}
405{-# INLINE intersperseM #-}
399intersperseM :: Monad m => m a -> Stream m a -> Stream m a
406intersperseM :: Monad m => m a -> Stream m a -> Stream m a
400intersperseM m = fromStreamD . D.intersperseM m . toStreamD
407intersperseM m = fromStreamD . D.intersperseM m . toStreamD
@@ -414,6 +421,7 @@ intersperseM m = fromStreamD . D.intersperseM m . toStreamD
414--
421--
415-- >>> reverse = Stream.foldlT (flip Stream.cons) Stream.nil
422-- >>> reverse = Stream.foldlT (flip Stream.cons) Stream.nil
416--
423--
424+-- @since 0.9.0
417{-# INLINE reverse #-}
425{-# INLINE reverse #-}
418reverse :: Monad m => Stream m a -> Stream m a
426reverse :: Monad m => Stream m a -> Stream m a
419reverse s = fromStreamD $ D.reverse $ toStreamD s
427reverse s = fromStreamD $ D.reverse $ toStreamD s
@@ -442,6 +450,7 @@ reverse' =
442-- generation function is monadic, unlike 'concatMap', it can produce an
450-- generation function is monadic, unlike 'concatMap', it can produce an
443-- effect at the beginning of each iteration of the inner loop.
451-- effect at the beginning of each iteration of the inner loop.
444--
452--
453+-- @since 0.9.0
445{-# INLINE concatMapM #-}
454{-# INLINE concatMapM #-}
446concatMapM :: Monad m => (a -> m (Stream m b)) -> Stream m a -> Stream m b
455concatMapM :: Monad m => (a -> m (Stream m b)) -> Stream m a -> Stream m b
447concatMapM f m = fromStreamD $ D.concatMapM (fmap toStreamD . f) (toStreamD m)
456concatMapM f m = fromStreamD $ D.concatMapM (fmap toStreamD . f) (toStreamD m)
@@ -454,6 +463,7 @@ concatMapM f m = fromStreamD $ D.concatMapM (fmap toStreamD . f) (toStreamD m)
454-- >>> concatMap f = Stream.concat . fmap f
463-- >>> concatMap f = Stream.concat . fmap f
455-- >>> concatMap f = Stream.unfoldMany (Unfold.lmap f Unfold.fromStream)
464-- >>> concatMap f = Stream.unfoldMany (Unfold.lmap f Unfold.fromStream)
456--
465--
466+-- @since 0.9.0
457{-# INLINE concatMap #-}
467{-# INLINE concatMap #-}
458concatMap ::Monad m => (a -> Stream m b) -> Stream m a -> Stream m b
468concatMap ::Monad m => (a -> Stream m b) -> Stream m a -> Stream m b
459concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
469concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
@@ -500,6 +510,7 @@ foldManyPost f m = fromStreamD $ D.foldManyPost f (toStreamD m)
500
510
501-- | Like 'zipWith' but using a monadic zipping function.
511-- | Like 'zipWith' but using a monadic zipping function.
502--
512--
513+-- @since 0.9.0
503{-# INLINE zipWithM #-}
514{-# INLINE zipWithM #-}
504zipWithM :: Monad m =>
515zipWithM :: Monad m =>
505 (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c
516 (a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c
@@ -517,6 +528,7 @@ zipWithM f m1 m2 = fromStreamD $ D.zipWithM f (toStreamD m1) (toStreamD m2)
517-- >>> Stream.fold Fold.toList $ Stream.zipWith (+) s1 s2
528-- >>> Stream.fold Fold.toList $ Stream.zipWith (+) s1 s2
518-- [5,7,9]
529-- [5,7,9]
519--
530--
531+-- @since 0.9.0
520{-# INLINE zipWith #-}
532{-# INLINE zipWith #-}
521zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
533zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
522zipWith f m1 m2 = fromStreamD $ D.zipWith f (toStreamD m1) (toStreamD m2)
534zipWith f m1 m2 = fromStreamD $ D.zipWith f (toStreamD m1) (toStreamD m2)
core/src/Streamly/Internal/Data/Stream/Eliminate.hs+6−2
@@ -127,6 +127,7 @@ import Prelude hiding (foldr, reverse)
127--
127--
128-- /Not fused/
128-- /Not fused/
129--
129--
130+-- @since 0.9.0
130{-# INLINE uncons #-}
131{-# INLINE uncons #-}
131uncons :: Monad m => Stream m a -> m (Maybe (a, Stream m a))
132uncons :: Monad m => Stream m a -> m (Maybe (a, Stream m a))
132uncons m = fmap (fmap (fmap fromStreamK)) $ K.uncons (toStreamK m)
133uncons m = fmap (fmap (fmap fromStreamK)) $ K.uncons (toStreamK m)
@@ -230,8 +231,7 @@ parseK = parse
230--
231--
231-- Note: @parse p@ is not the same as @head . parseMany p@ on an empty stream.
232-- Note: @parse p@ is not the same as @head . parseMany p@ on an empty stream.
232--
233--
233−-- /Pre-release/
234+-- @since 0.9.0
234−--
235{-# INLINE [3] parse #-}
235{-# INLINE [3] parse #-}
236parse :: MonadThrow m => Parser m a b -> Stream m a -> m b
236parse :: MonadThrow m => Parser m a b -> Stream m a -> m b
237parse = parseD . PRD.fromParserK
237parse = parseD . PRD.fromParserK
@@ -247,6 +247,7 @@ parseBreakD parser strm = do
247--
247--
248-- /Not fused/
248-- /Not fused/
249--
249--
250+-- @since 0.9.0
250{-# INLINE parseBreak #-}
251{-# INLINE parseBreak #-}
251parseBreak :: MonadThrow m => Parser m a b -> Stream m a -> m (b, Stream m a)
252parseBreak :: MonadThrow m => Parser m a b -> Stream m a -> m (b, Stream m a)
252parseBreak p strm = fmap f $ K.parseBreak (PRD.fromParserK p) (toStreamK strm)
253parseBreak p strm = fmap f $ K.parseBreak (PRD.fromParserK p) (toStreamK strm)
@@ -265,6 +266,7 @@ parseBreak p strm = fmap f $ K.parseBreak (PRD.fromParserK p) (toStreamK strm)
265-- >>> Stream.isPrefixOf (Stream.fromList "hello") (Stream.fromList "hello" :: Stream IO Char)
266-- >>> Stream.isPrefixOf (Stream.fromList "hello") (Stream.fromList "hello" :: Stream IO Char)
266-- True
267-- True
267--
268--
269+-- @since 0.9.0
268{-# INLINE isPrefixOf #-}
270{-# INLINE isPrefixOf #-}
269isPrefixOf :: (Monad m, Eq a) => Stream m a -> Stream m a -> m Bool
271isPrefixOf :: (Monad m, Eq a) => Stream m a -> Stream m a -> m Bool
270isPrefixOf m1 m2 = D.isPrefixOf (toStreamD m1) (toStreamD m2)
272isPrefixOf m1 m2 = D.isPrefixOf (toStreamD m1) (toStreamD m2)
@@ -330,6 +332,7 @@ isSuffixOf suffix stream = reverse suffix `isPrefixOf` reverse stream
330-- >>> Stream.isSubsequenceOf (Stream.fromList "hlo") (Stream.fromList "hello" :: Stream IO Char)
332-- >>> Stream.isSubsequenceOf (Stream.fromList "hlo") (Stream.fromList "hello" :: Stream IO Char)
331-- True
333-- True
332--
334--
335+-- @since 0.9.0
333{-# INLINE isSubsequenceOf #-}
336{-# INLINE isSubsequenceOf #-}
334isSubsequenceOf :: (Monad m, Eq a) => Stream m a -> Stream m a -> m Bool
337isSubsequenceOf :: (Monad m, Eq a) => Stream m a -> Stream m a -> m Bool
335isSubsequenceOf m1 m2 = D.isSubsequenceOf (toStreamD m1) (toStreamD m2)
338isSubsequenceOf m1 m2 = D.isSubsequenceOf (toStreamD m1) (toStreamD m2)
@@ -347,6 +350,7 @@ isSubsequenceOf m1 m2 = D.isSubsequenceOf (toStreamD m1) (toStreamD m2)
347--
350--
348-- Space: @O(1)@
351-- Space: @O(1)@
349--
352--
353+-- @since 0.9.0
350{-# INLINE stripPrefix #-}
354{-# INLINE stripPrefix #-}
351stripPrefix
355stripPrefix
352 :: (Monad m, Eq a)
356 :: (Monad m, Eq a)
core/src/Streamly/Internal/Data/Stream/Enumerate.hs+20−20
@@ -92,7 +92,7 @@ import qualified Streamly.Internal.Data.Stream.StreamD.Generate as D
92--
92--
93-- @
93-- @
94--
94--
95−-- @since 0.6.0
95+-- @since 0.9.0
96{-# INLINE enumerateFromStepIntegral #-}
96{-# INLINE enumerateFromStepIntegral #-}
97enumerateFromStepIntegral
97enumerateFromStepIntegral
98 :: (Monad m, Integral a)
98 :: (Monad m, Integral a)
@@ -110,7 +110,7 @@ enumerateFromStepIntegral from stride =
110--
110--
111-- @
111-- @
112--
112--
113−-- @since 0.6.0
113+-- @since 0.9.0
114{-# INLINE enumerateFromIntegral #-}
114{-# INLINE enumerateFromIntegral #-}
115enumerateFromIntegral
115enumerateFromIntegral
116 :: (Monad m, Integral a, Bounded a)
116 :: (Monad m, Integral a, Bounded a)
@@ -131,7 +131,7 @@ enumerateFromIntegral from = fromStreamD $ D.enumerateFromIntegral from
131--
131--
132-- @
132-- @
133--
133--
134−-- @since 0.6.0
134+-- @since 0.9.0
135{-# INLINE enumerateFromThenIntegral #-}
135{-# INLINE enumerateFromThenIntegral #-}
136enumerateFromThenIntegral
136enumerateFromThenIntegral
137 :: (Monad m, Integral a, Bounded a)
137 :: (Monad m, Integral a, Bounded a)
@@ -150,7 +150,7 @@ enumerateFromThenIntegral from next =
150--
150--
151-- @
151-- @
152--
152--
153−-- @since 0.6.0
153+-- @since 0.9.0
154{-# INLINE enumerateFromToIntegral #-}
154{-# INLINE enumerateFromToIntegral #-}
155enumerateFromToIntegral :: (Monad m, Integral a) => a -> a -> Stream m a
155enumerateFromToIntegral :: (Monad m, Integral a) => a -> a -> Stream m a
156enumerateFromToIntegral from to =
156enumerateFromToIntegral from to =
@@ -170,7 +170,7 @@ enumerateFromToIntegral from to =
170--
170--
171-- @
171-- @
172--
172--
173−-- @since 0.6.0
173+-- @since 0.9.0
174{-# INLINE enumerateFromThenToIntegral #-}
174{-# INLINE enumerateFromThenToIntegral #-}
175enumerateFromThenToIntegral
175enumerateFromThenToIntegral
176 :: (Monad m, Integral a)
176 :: (Monad m, Integral a)
@@ -201,7 +201,7 @@ enumerateFromThenToIntegral from next to =
201-- @
201-- @
202--
202--
203--
203--
204−-- @since 0.6.0
204+-- @since 0.9.0
205{-# INLINE enumerateFromFractional #-}
205{-# INLINE enumerateFromFractional #-}
206enumerateFromFractional :: (Monad m, Fractional a) => a -> Stream m a
206enumerateFromFractional :: (Monad m, Fractional a) => a -> Stream m a
207enumerateFromFractional from = fromStreamD $ D.enumerateFromNum from
207enumerateFromFractional from = fromStreamD $ D.enumerateFromNum from
@@ -224,7 +224,7 @@ enumerateFromFractional from = fromStreamD $ D.enumerateFromNum from
224--
224--
225-- @
225-- @
226--
226--
227−-- @since 0.6.0
227+-- @since 0.9.0
228{-# INLINE enumerateFromThenFractional #-}
228{-# INLINE enumerateFromThenFractional #-}
229enumerateFromThenFractional
229enumerateFromThenFractional
230 :: (Monad m, Fractional a)
230 :: (Monad m, Fractional a)
@@ -251,7 +251,7 @@ enumerateFromThenFractional from next = fromStreamD $ D.enumerateFromThenNum fro
251-- Notice that the last element is equal to the specified @to@ value after
251-- Notice that the last element is equal to the specified @to@ value after
252-- rounding to the nearest integer.
252-- rounding to the nearest integer.
253--
253--
254−-- @since 0.6.0
254+-- @since 0.9.0
255{-# INLINE enumerateFromToFractional #-}
255{-# INLINE enumerateFromToFractional #-}
256enumerateFromToFractional
256enumerateFromToFractional
257 :: (Monad m, Fractional a, Ord a)
257 :: (Monad m, Fractional a, Ord a)
@@ -277,7 +277,7 @@ enumerateFromToFractional from to =
277-- @
277-- @
278--
278--
279--
279--
280−-- @since 0.6.0
280+-- @since 0.9.0
281{-# INLINE enumerateFromThenToFractional #-}
281{-# INLINE enumerateFromThenToFractional #-}
282enumerateFromThenToFractional
282enumerateFromThenToFractional
283 :: (Monad m, Fractional a, Ord a)
283 :: (Monad m, Fractional a, Ord a)
@@ -291,7 +291,7 @@ enumerateFromThenToFractional from next to =
291--
291--
292-- | 'enumerateFromTo' for 'Enum' types not larger than 'Int'.
292-- | 'enumerateFromTo' for 'Enum' types not larger than 'Int'.
293--
293--
294−-- @since 0.6.0
294+-- @since 0.9.0
295{-# INLINE enumerateFromToSmall #-}
295{-# INLINE enumerateFromToSmall #-}
296enumerateFromToSmall :: (Monad m, Enum a) => a -> a -> Stream m a
296enumerateFromToSmall :: (Monad m, Enum a) => a -> a -> Stream m a
297enumerateFromToSmall from to =
297enumerateFromToSmall from to =
@@ -300,7 +300,7 @@ enumerateFromToSmall from to =
300
300
301-- | 'enumerateFromThenTo' for 'Enum' types not larger than 'Int'.
301-- | 'enumerateFromThenTo' for 'Enum' types not larger than 'Int'.
302--
302--
303−-- @since 0.6.0
303+-- @since 0.9.0
304{-# INLINE enumerateFromThenToSmall #-}
304{-# INLINE enumerateFromThenToSmall #-}
305enumerateFromThenToSmall :: (Monad m, Enum a)
305enumerateFromThenToSmall :: (Monad m, Enum a)
306 => a -> a -> a -> Stream m a
306 => a -> a -> a -> Stream m a
@@ -317,7 +317,7 @@ enumerateFromThenToSmall from next to =
317-- of 'toEnum' when converting back to 'Enum'. Therefore we require a 'Bounded'
317-- of 'toEnum' when converting back to 'Enum'. Therefore we require a 'Bounded'
318-- instance for this function to be safely used.
318-- instance for this function to be safely used.
319--
319--
320−-- @since 0.6.0
320+-- @since 0.9.0
321{-# INLINE enumerateFromThenSmallBounded #-}
321{-# INLINE enumerateFromThenSmallBounded #-}
322enumerateFromThenSmallBounded :: (Monad m, Enumerable a, Bounded a)
322enumerateFromThenSmallBounded :: (Monad m, Enumerable a, Bounded a)
323 => a -> a -> Stream m a
323 => a -> a -> Stream m a
@@ -344,7 +344,7 @@ enumerateFromThenSmallBounded from next =
344-- generate a stream instead of a list. Use the functions in
344-- generate a stream instead of a list. Use the functions in
345-- "Streamly.Internal.Data.Stream.Enumeration" module to define new instances.
345-- "Streamly.Internal.Data.Stream.Enumeration" module to define new instances.
346--
346--
347−-- @since 0.6.0
347+-- @since 0.9.0
348class Enum a => Enumerable a where
348class Enum a => Enumerable a where
349 -- | @enumerateFrom from@ generates a stream starting with the element
349 -- | @enumerateFrom from@ generates a stream starting with the element
350 -- @from@, enumerating up to 'maxBound' when the type is 'Bounded' or
350 -- @from@, enumerating up to 'maxBound' when the type is 'Bounded' or
@@ -365,7 +365,7 @@ class Enum a => Enumerable a where
365 --
365 --
366 -- @
366 -- @
367 --
367 --
368− -- @since 0.6.0
368+ -- @since 0.9.0
369 enumerateFrom :: (Monad m) => a -> Stream m a
369 enumerateFrom :: (Monad m) => a -> Stream m a
370
370
371 -- | Generate a finite stream starting with the element @from@, enumerating
371 -- | Generate a finite stream starting with the element @from@, enumerating
@@ -390,7 +390,7 @@ class Enum a => Enumerable a where
390 --
390 --
391 -- @
391 -- @
392 --
392 --
393− -- @since 0.6.0
393+ -- @since 0.9.0
394 enumerateFromTo :: (Monad m) => a -> a -> Stream m a
394 enumerateFromTo :: (Monad m) => a -> a -> Stream m a
395
395
396 -- | @enumerateFromThen from then@ generates a stream whose first element
396 -- | @enumerateFromThen from then@ generates a stream whose first element
@@ -409,7 +409,7 @@ class Enum a => Enumerable a where
409 --
409 --
410 -- @
410 -- @
411 --
411 --
412− -- @since 0.6.0
412+ -- @since 0.9.0
413 enumerateFromThen :: (Monad m) => a -> a -> Stream m a
413 enumerateFromThen :: (Monad m) => a -> a -> Stream m a
414
414
415 -- | @enumerateFromThenTo from then to@ generates a finite stream whose
415 -- | @enumerateFromThenTo from then to@ generates a finite stream whose
@@ -427,7 +427,7 @@ class Enum a => Enumerable a where
427 --
427 --
428 -- @
428 -- @
429 --
429 --
430− -- @since 0.6.0
430+ -- @since 0.9.0
431 enumerateFromThenTo :: (Monad m) => a -> a -> a -> Stream m a
431 enumerateFromThenTo :: (Monad m) => a -> a -> a -> Stream m a
432
432
433-- MAYBE: Sometimes it is more convenient to know the count rather then the
433-- MAYBE: Sometimes it is more convenient to know the count rather then the
@@ -450,7 +450,7 @@ class Enum a => Enumerable a where
450--
450--
451-- Enumerate a 'Bounded' type from its 'minBound' to 'maxBound'
451-- Enumerate a 'Bounded' type from its 'minBound' to 'maxBound'
452--
452--
453−-- @since 0.6.0
453+-- @since 0.9.0
454{-# INLINE enumerate #-}
454{-# INLINE enumerate #-}
455enumerate :: (Monad m, Bounded a, Enumerable a) => Stream m a
455enumerate :: (Monad m, Bounded a, Enumerable a) => Stream m a
456enumerate = enumerateFrom minBound
456enumerate = enumerateFrom minBound
@@ -460,7 +460,7 @@ enumerate = enumerateFrom minBound
460--
460--
461-- Enumerate a 'Bounded' type from its 'minBound' to specified value.
461-- Enumerate a 'Bounded' type from its 'minBound' to specified value.
462--
462--
463−-- @since 0.6.0
463+-- @since 0.9.0
464{-# INLINE enumerateTo #-}
464{-# INLINE enumerateTo #-}
465enumerateTo :: (Monad m, Bounded a, Enumerable a) => a -> Stream m a
465enumerateTo :: (Monad m, Bounded a, Enumerable a) => a -> Stream m a
466enumerateTo = enumerateFromTo minBound
466enumerateTo = enumerateFromTo minBound
@@ -470,7 +470,7 @@ enumerateTo = enumerateFromTo minBound
470--
470--
471-- 'enumerateFrom' for 'Bounded' 'Enum' types.
471-- 'enumerateFrom' for 'Bounded' 'Enum' types.
472--
472--
473−-- @since 0.6.0
473+-- @since 0.9.0
474{-# INLINE enumerateFromBounded #-}
474{-# INLINE enumerateFromBounded #-}
475enumerateFromBounded :: (Monad m, Enumerable a, Bounded a)
475enumerateFromBounded :: (Monad m, Enumerable a, Bounded a)
476 => a -> Stream m a
476 => a -> Stream m a
core/src/Streamly/Internal/Data/Stream/Exception.hs+6
@@ -46,6 +46,7 @@ import qualified Streamly.Internal.Data.Stream.StreamD as D
46-- >>> before action xs = Stream.nilM action <> xs
46-- >>> before action xs = Stream.nilM action <> xs
47-- >>> before action xs = Stream.concatMap (const xs) (Stream.fromEffect action)
47-- >>> before action xs = Stream.concatMap (const xs) (Stream.fromEffect action)
48--
48--
49+-- @since 0.9.0
49{-# INLINE before #-}
50{-# INLINE before #-}
50before :: Monad m => m b -> Stream m a -> Stream m a
51before :: Monad m => m b -> Stream m a -> Stream m a
51before action xs = fromStreamD $ D.before action $ toStreamD xs
52before action xs = fromStreamD $ D.before action $ toStreamD xs
@@ -75,6 +76,7 @@ after_ action xs = fromStreamD $ D.after_ action $ toStreamD xs
75--
76--
76-- /See also 'after_'/
77-- /See also 'after_'/
77--
78--
79+-- @since 0.9.0
78{-# INLINE after #-}
80{-# INLINE after #-}
79after :: MonadAsync m
81after :: MonadAsync m
80 => m b -> Stream m a -> Stream m a
82 => m b -> Stream m a -> Stream m a
@@ -85,6 +87,7 @@ after action xs = fromStreamD $ D.after action $ toStreamD xs
85--
87--
86-- /Inhibits stream fusion/
88-- /Inhibits stream fusion/
87--
89--
90+-- @since 0.9.0
88{-# INLINE onException #-}
91{-# INLINE onException #-}
89onException :: MonadCatch m => m b -> Stream m a -> Stream m a
92onException :: MonadCatch m => m b -> Stream m a -> Stream m a
90onException action xs = fromStreamD $ D.onException action $ toStreamD xs
93onException action xs = fromStreamD $ D.onException action $ toStreamD xs
@@ -117,6 +120,7 @@ finally_ action xs = fromStreamD $ D.finally_ action $ toStreamD xs
117--
120--
118-- /Inhibits stream fusion/
121-- /Inhibits stream fusion/
119--
122--
123+-- @since 0.9.0
120{-# INLINE finally #-}
124{-# INLINE finally #-}
121finally :: (MonadAsync m, MonadCatch m) => m b -> Stream m a -> Stream m a
125finally :: (MonadAsync m, MonadCatch m) => m b -> Stream m a -> Stream m a
122finally action xs = fromStreamD $ D.finally action $ toStreamD xs
126finally action xs = fromStreamD $ D.finally action $ toStreamD xs
@@ -160,6 +164,7 @@ bracket_ bef aft bet = fromStreamD $
160--
164--
161-- /Inhibits stream fusion/
165-- /Inhibits stream fusion/
162--
166--
167+-- @since 0.9.0
163{-# INLINE bracket #-}
168{-# INLINE bracket #-}
164bracket :: (MonadAsync m, MonadCatch m)
169bracket :: (MonadAsync m, MonadCatch m)
165 => m b -> (b -> m c) -> (b -> Stream m a) -> Stream m a
170 => m b -> (b -> m c) -> (b -> Stream m a) -> Stream m a
@@ -212,6 +217,7 @@ ghandle handler =
212--
217--
213-- /Inhibits stream fusion/
218-- /Inhibits stream fusion/
214--
219--
220+-- @since 0.9.0
215{-# INLINE handle #-}
221{-# INLINE handle #-}
216handle :: (MonadCatch m, Exception e)
222handle :: (MonadCatch m, Exception e)
217 => (e -> Stream m a) -> Stream m a -> Stream m a
223 => (e -> Stream m a) -> Stream m a -> Stream m a
core/src/Streamly/Internal/Data/Stream/Expand.hs+9−3
@@ -163,7 +163,7 @@ infixr 6 `append2`
163--
163--
164-- /Fused/
164-- /Fused/
165--
165--
166−-- /Pre-release/
166+-- @since 0.9.0
167{-# INLINE append2 #-}
167{-# INLINE append2 #-}
168append2 ::Monad m => Stream m b -> Stream m b -> Stream m b
168append2 ::Monad m => Stream m b -> Stream m b -> Stream m b
169append2 m1 m2 = fromStreamD $ D.append (toStreamD m1) (toStreamD m2)
169append2 m1 m2 = fromStreamD $ D.append (toStreamD m1) (toStreamD m2)
@@ -184,8 +184,7 @@ infixr 6 `append`
184--
184--
185-- /Not fused/
185-- /Not fused/
186--
186--
187−-- /Pre-release/
187+-- @since 0.9.0
188−--
189{-# INLINE append #-}
188{-# INLINE append #-}
190append :: Stream m a -> Stream m a -> Stream m a
189append :: Stream m a -> Stream m a -> Stream m a
191append = (<>)
190append = (<>)
@@ -204,6 +203,8 @@ append = (<>)
204-- streams.
203-- streams.
205--
204--
206-- /Not fused/
205-- /Not fused/
206+--
207+-- @since 0.9.0
207{-# INLINE interleave #-}
208{-# INLINE interleave #-}
208interleave :: Stream m a -> Stream m a -> Stream m a
209interleave :: Stream m a -> Stream m a -> Stream m a
209interleave s1 s2 = fromStreamK $ K.interleave (toStreamK s1) (toStreamK s2)
210interleave s1 s2 = fromStreamK $ K.interleave (toStreamK s1) (toStreamK s2)
@@ -245,6 +246,7 @@ interleaveMin s1 s2 =
245--
246--
246-- See also: 'mergeByM2'
247-- See also: 'mergeByM2'
247--
248--
249+-- @since 0.9.0
248{-# INLINE mergeBy #-}
250{-# INLINE mergeBy #-}
249mergeBy :: (a -> a -> Ordering) -> Stream m a -> Stream m a -> Stream m a
251mergeBy :: (a -> a -> Ordering) -> Stream m a -> Stream m a -> Stream m a
250mergeBy f m1 m2 = fromStreamK $ K.mergeBy f (toStreamK m1) (toStreamK m2)
252mergeBy f m1 m2 = fromStreamK $ K.mergeBy f (toStreamK m1) (toStreamK m2)
@@ -279,6 +281,7 @@ mergeBy f m1 m2 = fromStreamK $ K.mergeBy f (toStreamK m1) (toStreamK m2)
279--
281--
280-- See also: 'mergeByM2'
282-- See also: 'mergeByM2'
281--
283--
284+-- @since 0.9.0
282{-# INLINE mergeByM #-}
285{-# INLINE mergeByM #-}
283mergeByM
286mergeByM
284 :: Monad m
287 :: Monad m
@@ -324,6 +327,7 @@ mergeFstBy _f _m1 _m2 = undefined
324-- 'concatMap' this can fuse the 'Unfold' code with the inner loop and
327-- 'concatMap' this can fuse the 'Unfold' code with the inner loop and
325-- therefore provide many times better performance.
328-- therefore provide many times better performance.
326--
329--
330+-- @since 0.9.0
327{-# INLINE unfoldMany #-}
331{-# INLINE unfoldMany #-}
328unfoldMany ::Monad m => Unfold m a b -> Stream m a -> Stream m b
332unfoldMany ::Monad m => Unfold m a b -> Stream m a -> Stream m b
329unfoldMany u m = fromStreamD $ D.unfoldMany u (toStreamD m)
333unfoldMany u m = fromStreamD $ D.unfoldMany u (toStreamD m)
@@ -427,6 +431,7 @@ gintercalate unf1 str1 unf2 str2 =
427-- >>> Stream.fold Fold.toList $ Stream.intercalate Unfold.fromList " " input
431-- >>> Stream.fold Fold.toList $ Stream.intercalate Unfold.fromList " " input
428-- "abc def ghi"
432-- "abc def ghi"
429--
433--
434+-- @since 0.9.0
430{-# INLINE intercalate #-}
435{-# INLINE intercalate #-}
431intercalate :: Monad m
436intercalate :: Monad m
432 => Unfold m b c -> b -> Stream m b -> Stream m c
437 => Unfold m b c -> b -> Stream m b -> Stream m c
@@ -457,6 +462,7 @@ gintercalateSuffix unf1 str1 unf2 str2 =
457-- >>> Stream.fold Fold.toList $ Stream.intercalateSuffix Unfold.fromList "\n" input
462-- >>> Stream.fold Fold.toList $ Stream.intercalateSuffix Unfold.fromList "\n" input
458-- "abc\ndef\nghi\n"
463-- "abc\ndef\nghi\n"
459--
464--
465+-- @since 0.9.0
460{-# INLINE intercalateSuffix #-}
466{-# INLINE intercalateSuffix #-}
461intercalateSuffix :: Monad m
467intercalateSuffix :: Monad m
462 => Unfold m b c -> b -> Stream m b -> Stream m c
468 => Unfold m b c -> b -> Stream m b -> Stream m c
core/src/Streamly/Internal/Data/Stream/Generate.hs+8−2
@@ -118,7 +118,7 @@ import Prelude hiding (iterate, replicate, repeat)
118-- hello
118-- hello
119-- hello
119-- hello
120--
120--
121−-- /Pre-release/
121+-- @since 0.9.0
122{-# INLINE unfold #-}
122{-# INLINE unfold #-}
123unfold :: Monad m => Unfold m a b -> a -> Stream m b
123unfold :: Monad m => Unfold m a b -> a -> Stream m b
124unfold unf = Stream.fromStreamD . D.unfold unf
124unfold unf = Stream.fromStreamD . D.unfold unf
@@ -149,6 +149,7 @@ unfold unf = Stream.fromStreamD . D.unfold unf
149-- :}
149-- :}
150-- [0,1,2]
150-- [0,1,2]
151--
151--
152+-- @since 0.9.0
152{-# INLINE_EARLY unfoldr #-}
153{-# INLINE_EARLY unfoldr #-}
153unfoldr :: Monad m => (b -> Maybe (a, b)) -> b -> Stream m a
154unfoldr :: Monad m => (b -> Maybe (a, b)) -> b -> Stream m a
154unfoldr step seed = fromStreamD (D.unfoldr step seed)
155unfoldr step seed = fromStreamD (D.unfoldr step seed)
@@ -169,7 +170,7 @@ unfoldr step seed = fromStreamD (D.unfoldr step seed)
169-- :}
170-- :}
170-- [0,1,2]
171-- [0,1,2]
171--
172--
172−--
173+-- @since 0.9.0
173{-# INLINE unfoldrM #-}
174{-# INLINE unfoldrM #-}
174unfoldrM :: Monad m => (b -> m (Maybe (a, b))) -> b -> Stream m a
175unfoldrM :: Monad m => (b -> m (Maybe (a, b))) -> b -> Stream m a
175unfoldrM step = fromStreamD . D.unfoldrM step
176unfoldrM step = fromStreamD . D.unfoldrM step
@@ -181,6 +182,7 @@ unfoldrM step = fromStreamD . D.unfoldrM step
181-- |
182-- |
182-- Generate an infinite stream by repeating a pure value.
183-- Generate an infinite stream by repeating a pure value.
183--
184--
185+-- @since 0.9.0
184{-# INLINE_NORMAL repeat #-}
186{-# INLINE_NORMAL repeat #-}
185repeat :: Monad m => a -> Stream m a
187repeat :: Monad m => a -> Stream m a
186repeat = fromStreamD . D.repeat
188repeat = fromStreamD . D.repeat
@@ -190,6 +192,7 @@ repeat = fromStreamD . D.repeat
190--
192--
191-- Generate a stream of length @n@ by repeating a value @n@ times.
193-- Generate a stream of length @n@ by repeating a value @n@ times.
192--
194--
195+-- @since 0.9.0
193{-# INLINE_NORMAL replicate #-}
196{-# INLINE_NORMAL replicate #-}
194replicate :: Monad m => Int -> a -> Stream m a
197replicate :: Monad m => Int -> a -> Stream m a
195replicate n = fromStreamD . D.replicate n
198replicate n = fromStreamD . D.replicate n
@@ -293,6 +296,7 @@ timeout = undefined
293-- >>> Stream.fold Fold.toList $ Stream.take 5 $ Stream.iterate (+1) 1
296-- >>> Stream.fold Fold.toList $ Stream.take 5 $ Stream.iterate (+1) 1
294-- [1,2,3,4,5]
297-- [1,2,3,4,5]
295--
298--
299+-- @since 0.9.0
296{-# INLINE_NORMAL iterate #-}
300{-# INLINE_NORMAL iterate #-}
297iterate :: Monad m => (a -> a) -> a -> Stream m a
301iterate :: Monad m => (a -> a) -> a -> Stream m a
298iterate step = fromStreamD . D.iterate step
302iterate step = fromStreamD . D.iterate step
@@ -313,6 +317,7 @@ iterate step = fromStreamD . D.iterate step
313-- 1
317-- 1
314-- [0,1,2]
318-- [0,1,2]
315--
319--
320+-- @since 0.9.0
316{-# INLINE iterateM #-}
321{-# INLINE iterateM #-}
317iterateM :: Monad m => (a -> m a) -> m a -> Stream m a
322iterateM :: Monad m => (a -> m a) -> m a -> Stream m a
318iterateM step = fromStreamD . D.iterateM step
323iterateM step = fromStreamD . D.iterateM step
@@ -385,6 +390,7 @@ mfix f = fromStreamK $ K.mfix (toStreamK . f)
385--
390--
386-- /Not fused/
391-- /Not fused/
387--
392--
393+-- @since 0.9.0
388{-# INLINE fromFoldable #-}
394{-# INLINE fromFoldable #-}
389fromFoldable :: Foldable f => f a -> Stream m a
395fromFoldable :: Foldable f => f a -> Stream m a
390fromFoldable = fromStreamK . K.fromFoldable
396fromFoldable = fromStreamK . K.fromFoldable
core/src/Streamly/Internal/Data/Stream/Lift.hs+3
@@ -66,6 +66,7 @@ generally xs = fromStreamK $ K.hoist (return . runIdentity) (toStreamK xs)
66-- | Lift the inner monad @m@ of a stream @Stream m a@ to @tr m@ using the monad
66-- | Lift the inner monad @m@ of a stream @Stream m a@ to @tr m@ using the monad
67-- transformer @tr@.
67-- transformer @tr@.
68--
68--
69+-- @since 0.9.0
69{-# INLINE liftInner #-}
70{-# INLINE liftInner #-}
70liftInner :: (Monad m, MonadTrans tr, Monad (tr m))
71liftInner :: (Monad m, MonadTrans tr, Monad (tr m))
71 => Stream m a -> Stream (tr m) a
72 => Stream m a -> Stream (tr m) a
@@ -77,6 +78,7 @@ liftInner xs = fromStreamD $ D.liftInner (toStreamD xs)
77
78
78-- | Evaluate the inner monad of a stream as 'ReaderT'.
79-- | Evaluate the inner monad of a stream as 'ReaderT'.
79--
80--
81+-- @since 0.9.0
80{-# INLINE runReaderT #-}
82{-# INLINE runReaderT #-}
81runReaderT :: Monad m => m s -> Stream (ReaderT s m) a -> Stream m a
83runReaderT :: Monad m => m s -> Stream (ReaderT s m) a -> Stream m a
82runReaderT s xs = fromStreamD $ D.runReaderT s (toStreamD xs)
84runReaderT s xs = fromStreamD $ D.runReaderT s (toStreamD xs)
@@ -131,6 +133,7 @@ usingStateT s f = evalStateT s . f . liftInner
131-- | Evaluate the inner monad of a stream as 'StateT' and emit the resulting
133-- | Evaluate the inner monad of a stream as 'StateT' and emit the resulting
132-- state and value pair after each step.
134-- state and value pair after each step.
133--
135--
136+-- @since 0.9.0
134{-# INLINE runStateT #-}
137{-# INLINE runStateT #-}
135runStateT :: Monad m => m s -> Stream (StateT s m) a -> Stream m (s, a)
138runStateT :: Monad m => m s -> Stream (StateT s m) a -> Stream m (s, a)
136runStateT s xs = fromStreamD $ D.runStateT s (toStreamD xs)
139runStateT s xs = fromStreamD $ D.runStateT s (toStreamD xs)
core/src/Streamly/Internal/Data/Stream/Reduce.hs+1
@@ -145,6 +145,7 @@ dropSuffix = error "Not implemented yet!"
145-- Note 'foldMany' on an empty stream results in an empty stream. Therefore,
145-- Note 'foldMany' on an empty stream results in an empty stream. Therefore,
146-- @Stream.fold f@ is not the same as @Stream.head . Stream.foldMany f@.
146-- @Stream.fold f@ is not the same as @Stream.head . Stream.foldMany f@.
147--
147--
148+-- @since 0.9.0
148{-# INLINE foldMany #-}
149{-# INLINE foldMany #-}
149foldMany
150foldMany
150 :: Monad m
151 :: Monad m
core/src/Streamly/Internal/Data/Stream/Transform.hs+21−3
@@ -265,8 +265,7 @@ foldrT f z s = D.foldrT f z (toStreamD s)
265-- >>> Stream.fold Fold.drain $ Stream.mapM putStr s
265-- >>> Stream.fold Fold.drain $ Stream.mapM putStr s
266-- abc
266-- abc
267--
267--
268−-- /Pre-release/
268+-- @since 0.9.0
269−--
270{-# INLINE mapM #-}
269{-# INLINE mapM #-}
271mapM :: Monad m => (a -> m b) -> Stream m a -> Stream m b
270mapM :: Monad m => (a -> m b) -> Stream m a -> Stream m b
272mapM f m = fromStreamK $ D.toStreamK $ D.mapM f $ toStreamD m
271mapM f m = fromStreamK $ D.toStreamK $ D.mapM f $ toStreamD m
@@ -281,6 +280,7 @@ mapM f m = fromStreamK $ D.toStreamK $ D.mapM f $ toStreamD m
281-- >>> Stream.fold Fold.drain $ Stream.sequence s
280-- >>> Stream.fold Fold.drain $ Stream.sequence s
282-- abc
281-- abc
283--
282--
283+-- @since 0.9.0
284{-# INLINE sequence #-}
284{-# INLINE sequence #-}
285sequence :: Monad m => Stream m (m a) -> Stream m a
285sequence :: Monad m => Stream m (m a) -> Stream m a
286sequence = mapM id
286sequence = mapM id
@@ -307,6 +307,7 @@ sequence = mapM id
307--
307--
308-- Compare with 'trace'.
308-- Compare with 'trace'.
309--
309--
310+-- @since 0.9.0
310{-# INLINE tap #-}
311{-# INLINE tap #-}
311tap :: Monad m => FL.Fold m a b -> Stream m a -> Stream m a
312tap :: Monad m => FL.Fold m a b -> Stream m a -> Stream m a
312tap f xs = fromStreamD $ D.tap f (toStreamD xs)
313tap f xs = fromStreamD $ D.tap f (toStreamD xs)
@@ -363,6 +364,7 @@ trace_ eff = fromStreamD . D.mapM (\x -> eff >> return x) . toStreamD
363--
364--
364-- See also: 'usingStateT'
365-- See also: 'usingStateT'
365--
366--
367+-- @since 0.9.0
366
368
367-- EXPLANATION:
369-- EXPLANATION:
368-- >>> scanl' step z = Stream.scan (Fold.foldl' step z)
370-- >>> scanl' step z = Stream.scan (Fold.foldl' step z)
@@ -407,6 +409,7 @@ trace_ eff = fromStreamD . D.mapM (\x -> eff >> return x) . toStreamD
407-- lazy expressions inside the accumulator, it is recommended that a strict
409-- lazy expressions inside the accumulator, it is recommended that a strict
408-- data structure is used for accumulator.
410-- data structure is used for accumulator.
409--
411--
412+-- @since 0.9.0
410{-# INLINE scan #-}
413{-# INLINE scan #-}
411scan :: Monad m => Fold m a b -> Stream m a -> Stream m b
414scan :: Monad m => Fold m a b -> Stream m a -> Stream m b
412scan fld m = fromStreamD $ D.scanOnce fld $ toStreamD m
415scan fld m = fromStreamD $ D.scanOnce fld $ toStreamD m
@@ -414,7 +417,7 @@ scan fld m = fromStreamD $ D.scanOnce fld $ toStreamD m
414-- | Like 'scan' but restarts scanning afresh when the scanning fold
417-- | Like 'scan' but restarts scanning afresh when the scanning fold
415-- terminates.
418-- terminates.
416--
419--
417−-- /Pre-release/
420+-- @since 0.9.0
418{-# INLINE scanMany #-}
421{-# INLINE scanMany #-}
419scanMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
422scanMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
420scanMany fld m = fromStreamD $ D.scanMany fld $ toStreamD m
423scanMany fld m = fromStreamD $ D.scanMany fld $ toStreamD m
@@ -444,6 +447,7 @@ with f comb g = fmap snd . comb g . f
444-- >>> filter p = Stream.mapMaybe (\x -> if p x then Just x else Nothing)
447-- >>> filter p = Stream.mapMaybe (\x -> if p x then Just x else Nothing)
445-- >>> filter p = Stream.scanMaybe (Fold.filtering p)
448-- >>> filter p = Stream.scanMaybe (Fold.filtering p)
446--
449--
450+-- @since 0.9.0
447{-# INLINE filter #-}
451{-# INLINE filter #-}
448filter :: Monad m => (a -> Bool) -> Stream m a -> Stream m a
452filter :: Monad m => (a -> Bool) -> Stream m a -> Stream m a
449-- filter p = scanMaybe (FL.filtering p)
453-- filter p = scanMaybe (FL.filtering p)
@@ -454,6 +458,7 @@ filter p m = fromStreamD $ D.filter p $ toStreamD m
454-- >>> f p x = p x >>= \r -> return $ if r then Just x else Nothing
458-- >>> f p x = p x >>= \r -> return $ if r then Just x else Nothing
455-- >>> filterM p = Stream.mapMaybeM (f p)
459-- >>> filterM p = Stream.mapMaybeM (f p)
456--
460--
461+-- @since 0.9.0
457{-# INLINE filterM #-}
462{-# INLINE filterM #-}
458filterM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a
463filterM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a
459filterM p m = fromStreamD $ D.filterM p $ toStreamD m
464filterM p m = fromStreamD $ D.filterM p $ toStreamD m
@@ -493,6 +498,7 @@ uniqBy eq = catMaybes . rollingMap f
493--
498--
494-- >>> uniq = Stream.uniqBy (==)
499-- >>> uniq = Stream.uniqBy (==)
495--
500--
501+-- @since 0.9.0
496{-# INLINE uniq #-}
502{-# INLINE uniq #-}
497uniq :: (Eq a, Monad m) => Stream m a -> Stream m a
503uniq :: (Eq a, Monad m) => Stream m a -> Stream m a
498-- uniq = scanMaybe FL.uniq
504-- uniq = scanMaybe FL.uniq
@@ -539,6 +545,7 @@ repeated = undefined
539-- >>> Stream.fold Fold.toList $ Stream.deleteBy (==) 3 input
545-- >>> Stream.fold Fold.toList $ Stream.deleteBy (==) 3 input
540-- [1,3,5]
546-- [1,3,5]
541--
547--
548+-- @since 0.9.0
542{-# INLINE deleteBy #-}
549{-# INLINE deleteBy #-}
543deleteBy :: Monad m => (a -> a -> Bool) -> a -> Stream m a -> Stream m a
550deleteBy :: Monad m => (a -> a -> Bool) -> a -> Stream m a -> Stream m a
544-- deleteBy cmp x = scanMaybe (FL.deleteBy cmp x)
551-- deleteBy cmp x = scanMaybe (FL.deleteBy cmp x)
@@ -550,6 +557,7 @@ deleteBy cmp x m = fromStreamD $ D.deleteBy cmp x (toStreamD m)
550
557
551-- | Same as 'takeWhile' but with a monadic predicate.
558-- | Same as 'takeWhile' but with a monadic predicate.
552--
559--
560+-- @since 0.9.0
553{-# INLINE takeWhileM #-}
561{-# INLINE takeWhileM #-}
554takeWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a
562takeWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a
555-- takeWhileM p = scanMaybe (FL.takingEndByM_ (\x -> not <$> p x))
563-- takeWhileM p = scanMaybe (FL.takingEndByM_ (\x -> not <$> p x))
@@ -558,6 +566,7 @@ takeWhileM p m = fromStreamD $ D.takeWhileM p $ toStreamD m
558-- | Drop elements in the stream as long as the predicate succeeds and then
566-- | Drop elements in the stream as long as the predicate succeeds and then
559-- take the rest of the stream.
567-- take the rest of the stream.
560--
568--
569+-- @since 0.9.0
561{-# INLINE dropWhile #-}
570{-# INLINE dropWhile #-}
562dropWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a
571dropWhile :: Monad m => (a -> Bool) -> Stream m a -> Stream m a
563-- dropWhile p = scanMaybe (FL.droppingWhile p)
572-- dropWhile p = scanMaybe (FL.droppingWhile p)
@@ -565,6 +574,7 @@ dropWhile p m = fromStreamD $ D.dropWhile p $ toStreamD m
565
574
566-- | Same as 'dropWhile' but with a monadic predicate.
575-- | Same as 'dropWhile' but with a monadic predicate.
567--
576--
577+-- @since 0.9.0
568{-# INLINE dropWhileM #-}
578{-# INLINE dropWhileM #-}
569dropWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a
579dropWhileM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a
570-- dropWhileM p = scanMaybe (FL.droppingWhileM p)
580-- dropWhileM p = scanMaybe (FL.droppingWhileM p)
@@ -583,6 +593,7 @@ dropWhileM p m = fromStreamD $ D.dropWhileM p $ toStreamD m
583-- >>> Stream.fold Fold.toList $ Stream.insertBy compare 2 input
593-- >>> Stream.fold Fold.toList $ Stream.insertBy compare 2 input
584-- [1,2,3,5]
594-- [1,2,3,5]
585--
595--
596+-- @since 0.9.0
586{-# INLINE insertBy #-}
597{-# INLINE insertBy #-}
587insertBy ::Monad m => (a -> a -> Ordering) -> a -> Stream m a -> Stream m a
598insertBy ::Monad m => (a -> a -> Ordering) -> a -> Stream m a -> Stream m a
588insertBy cmp x m = fromStreamD $ D.insertBy cmp x (toStreamD m)
599insertBy cmp x m = fromStreamD $ D.insertBy cmp x (toStreamD m)
@@ -593,6 +604,7 @@ insertBy cmp x m = fromStreamD $ D.insertBy cmp x (toStreamD m)
593-- >>> Stream.fold Fold.toList $ Stream.intersperse ',' input
604-- >>> Stream.fold Fold.toList $ Stream.intersperse ',' input
594-- "h,e,l,l,o"
605-- "h,e,l,l,o"
595--
606--
607+-- @since 0.9.0
596{-# INLINE intersperse #-}
608{-# INLINE intersperse #-}
597intersperse :: Monad m => a -> Stream m a -> Stream m a
609intersperse :: Monad m => a -> Stream m a -> Stream m a
598intersperse a = fromStreamD . D.intersperse a . toStreamD
610intersperse a = fromStreamD . D.intersperse a . toStreamD
@@ -691,6 +703,7 @@ interspersePrefix_ m = mapM (\x -> void m >> return x)
691-- >>> sleep n = liftIO $ threadDelay $ round $ n * 1000000
703-- >>> sleep n = liftIO $ threadDelay $ round $ n * 1000000
692-- >>> delay n = Stream.intersperseM_ $ sleep n
704-- >>> delay n = Stream.intersperseM_ $ sleep n
693--
705--
706+-- @since 0.9.0
694{-# INLINE delay #-}
707{-# INLINE delay #-}
695delay :: MonadIO m => Double -> Stream m a -> Stream m a
708delay :: MonadIO m => Double -> Stream m a -> Stream m a
696delay n = intersperseM_ $ liftIO $ threadDelay $ round $ n * 1000000
709delay n = intersperseM_ $ liftIO $ threadDelay $ round $ n * 1000000
@@ -758,6 +771,7 @@ reassembleBy = undefined
758-- >>> Stream.fold Fold.toList $ Stream.indexed $ Stream.fromList "hello"
771-- >>> Stream.fold Fold.toList $ Stream.indexed $ Stream.fromList "hello"
759-- [(0,'h'),(1,'e'),(2,'l'),(3,'l'),(4,'o')]
772-- [(0,'h'),(1,'e'),(2,'l'),(3,'l'),(4,'o')]
760--
773--
774+-- @since 0.9.0
761{-# INLINE indexed #-}
775{-# INLINE indexed #-}
762indexed :: Monad m => Stream m a -> Stream m (Int, a)
776indexed :: Monad m => Stream m a -> Stream m (Int, a)
763-- indexed = scanMaybe FL.indexing
777-- indexed = scanMaybe FL.indexing
@@ -776,6 +790,7 @@ indexed = fromStreamD . D.indexed . toStreamD
776-- >>> Stream.fold Fold.toList $ Stream.indexedR 10 $ Stream.fromList "hello"
790-- >>> Stream.fold Fold.toList $ Stream.indexedR 10 $ Stream.fromList "hello"
777-- [(10,'h'),(9,'e'),(8,'l'),(7,'l'),(6,'o')]
791-- [(10,'h'),(9,'e'),(8,'l'),(7,'l'),(6,'o')]
778--
792--
793+-- @since 0.9.0
779{-# INLINE indexedR #-}
794{-# INLINE indexedR #-}
780indexedR :: Monad m => Int -> Stream m a -> Stream m (Int, a)
795indexedR :: Monad m => Int -> Stream m a -> Stream m (Int, a)
781-- indexedR n = scanMaybe (FL.indexingRev n)
796-- indexedR n = scanMaybe (FL.indexingRev n)
@@ -790,6 +805,7 @@ indexedR n = fromStreamD . D.indexedR n . toStreamD
790--
805--
791-- >>> elemIndices a = Stream.findIndices (== a)
806-- >>> elemIndices a = Stream.findIndices (== a)
792--
807--
808+-- @since 0.9.0
793{-# INLINE elemIndices #-}
809{-# INLINE elemIndices #-}
794elemIndices :: (Monad m, Eq a) => a -> Stream m a -> Stream m Int
810elemIndices :: (Monad m, Eq a) => a -> Stream m a -> Stream m Int
795elemIndices a = findIndices (== a)
811elemIndices a = findIndices (== a)
@@ -844,6 +860,7 @@ rollingMap2 f m = fromStreamD $ D.rollingMap2 f $ toStreamD m
844--
860--
845-- >>> mapMaybe f = Stream.catMaybes . fmap f
861-- >>> mapMaybe f = Stream.catMaybes . fmap f
846--
862--
863+-- @since 0.9.0
847{-# INLINE mapMaybe #-}
864{-# INLINE mapMaybe #-}
848mapMaybe :: Monad m => (a -> Maybe b) -> Stream m a -> Stream m b
865mapMaybe :: Monad m => (a -> Maybe b) -> Stream m a -> Stream m b
849mapMaybe f m = fromStreamD $ D.mapMaybe f $ toStreamD m
866mapMaybe f m = fromStreamD $ D.mapMaybe f $ toStreamD m
@@ -856,6 +873,7 @@ mapMaybe f m = fromStreamD $ D.mapMaybe f $ toStreamD m
856--
873--
857-- >>> mapM f = Stream.mapMaybeM (\x -> Just <$> f x)
874-- >>> mapM f = Stream.mapMaybeM (\x -> Just <$> f x)
858--
875--
876+-- @since 0.9.0
859{-# INLINE_EARLY mapMaybeM #-}
877{-# INLINE_EARLY mapMaybeM #-}
860mapMaybeM :: Monad m
878mapMaybeM :: Monad m
861 => (a -> m (Maybe b)) -> Stream m a -> Stream m b
879 => (a -> m (Maybe b)) -> Stream m a -> Stream m b
core/src/Streamly/Internal/Data/Stream/Type.hs+4
@@ -470,6 +470,7 @@ consM m = fromStreamK . K.consM m . toStreamK
470-- >>> Stream.fold Fold.toList Stream.nil
470-- >>> Stream.fold Fold.toList Stream.nil
471-- []
471-- []
472--
472--
473+-- @since 0.9.0
473{-# INLINE_NORMAL nil #-}
474{-# INLINE_NORMAL nil #-}
474nil :: Stream m a
475nil :: Stream m a
475nil = fromStreamK K.nil
476nil = fromStreamK K.nil
@@ -491,6 +492,7 @@ nilM = fromStreamK . K.nilM
491-- >>> fromPure = pure
492-- >>> fromPure = pure
492-- >>> fromPure = fromEffect . pure
493-- >>> fromPure = fromEffect . pure
493--
494--
495+-- @since 0.9.0
494{-# INLINE_NORMAL fromPure #-}
496{-# INLINE_NORMAL fromPure #-}
495fromPure :: a -> Stream m a
497fromPure :: a -> Stream m a
496fromPure = fromStreamK . K.fromPure
498fromPure = fromStreamK . K.fromPure
@@ -503,6 +505,7 @@ fromPure = fromStreamK . K.fromPure
503-- >>> Stream.fold Fold.drain $ Stream.fromEffect (putStrLn "hello")
505-- >>> Stream.fold Fold.drain $ Stream.fromEffect (putStrLn "hello")
504-- hello
506-- hello
505--
507--
508+-- @since 0.9.0
506{-# INLINE_NORMAL fromEffect #-}
509{-# INLINE_NORMAL fromEffect #-}
507fromEffect :: Monad m => m a -> Stream m a
510fromEffect :: Monad m => m a -> Stream m a
508fromEffect = fromStreamK . K.fromEffect
511fromEffect = fromStreamK . K.fromEffect
@@ -531,6 +534,7 @@ bindWith par m1 f =
531--
534--
532-- Note we can merge streams concurrently by using a concurrent merge function.
535-- Note we can merge streams concurrently by using a concurrent merge function.
533--
536--
537+-- @since 0.9.0
534{-# INLINE concatMapWith #-}
538{-# INLINE concatMapWith #-}
535concatMapWith
539concatMapWith
536 :: (Stream m b -> Stream m b -> Stream m b)
540 :: (Stream m b -> Stream m b -> Stream m b)