@@ -336,13 +336,21 @@ module Streamly.Prelude
337 -- ** Stateful Filters
337 -- ** Stateful Filters
339 , takeWhile
340 , takeWhile
340 , takeWhileM
341 , takeWhileM
342 , dropWhile
345 , dropWhile
343 , dropWhileM
346 , dropWhileM
344 , deleteBy
349 , deleteBy
351+ -- , uniqBy -- by predicate e.g. to remove duplicate "/" in a path
352+ -- , uniqOn -- to remove duplicate sequences
353+ -- , pruneBy -- dropAround + uniqBy - like words
347 -- ** Mapping Filters
355 -- ** Mapping Filters
348 -- | Mapping along with filtering
356 -- | Mapping along with filtering
@@ -390,6 +398,8 @@ module Streamly.Prelude
391 , concatMapM
399 , concatMapM
392 , concatMap
400 , concatMap
394 -- * Multi-Stream Operations
404 -- * Multi-Stream Operations
395 -- | New streams can be constructed by appending, merging or zipping
405 -- | New streams can be constructed by appending, merging or zipping
@@ -448,8 +458,12 @@ module Streamly.Prelude
450 , isPrefixOf
460 , isPrefixOf
451 , isSubsequenceOf
463 , isSubsequenceOf
452 , stripPrefix
464 , stripPrefix
454 -- * Deprecated
468 -- * Deprecated
@@ -946,11 +960,16 @@ foldrM = P.foldrM
947-- | Right fold to a streaming monad.
961-- | Right fold to a streaming monad.
963+-- > foldrS S.cons S.nil === id
949-- 'foldrS' can be used to perform stateless stream to stream transformations
965-- 'foldrS' can be used to perform stateless stream to stream transformations
950-- like map and filter in general. It can be coupled with a scan to perform
966-- like map and filter in general. It can be coupled with a scan to perform
951-- stateful transformations. However, note that the custom map and filter
967-- stateful transformations. However, note that the custom map and filter
952-- routines can be much more efficient than this due to better stream fusion.
968-- routines can be much more efficient than this due to better stream fusion.
970+-- >>> S.toList $ S.foldrS S.cons S.nil $ S.fromList [1..5]
954-- Find if any element in the stream is 'True':
973-- Find if any element in the stream is 'True':
956-- >>> S.toList $ S.foldrS (\x xs -> if odd x then return True else xs) (return False) $ (S.fromList (2:4:5:undefined) :: SerialT IO Int)
975-- >>> S.toList $ S.foldrS (\x xs -> if odd x then return True else xs) (return False) $ (S.fromList (2:4:5:undefined) :: SerialT IO Int)
@@ -2095,3 +2114,12 @@ concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
2095{-# INLINE concatMapM #-}
2114{-# INLINE concatMapM #-}
2096concatMapM :: (IsStream t, Monad m) => (a -> m (t m b)) -> t m a -> t m b
2115concatMapM :: (IsStream t, Monad m) => (a -> m (t m b)) -> t m a -> t m b
2097concatMapM f m = fromStreamD $ D.concatMapM (fmap toStreamD . f) (toStreamD m)
2116concatMapM f m = fromStreamD $ D.concatMapM (fmap toStreamD . f) (toStreamD m)
2119+-- | A generalization of insertBy to inserting sequences.
2120+interposeBy :: (IsStream t, Monad m)
2121+ => (a -> a -> Ordering) -> t m a -> t m a -> t m a
2123+-- | A generalization of intersperseM to intersperse sequences.
2124+intercalate :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a