@@ -448,9 +448,10 @@ module Streamly.Internal.Prelude
449 -- Flattening Nested Streams
449 -- Flattening Nested Streams
450 -- ** Folding Streams of Streams
450 -- ** Folding Streams of Streams
451− , concatMapM
451+ , concat
452 , concatM
452 , concatM
453 , concatMap
453 , concatMap
454 -- XXX add stateful concatMapWith?
455 -- XXX add stateful concatMapWith?
455 , concatMapWith
456 , concatMapWith
456 -- , bindWith
457 -- , bindWith
@@ -539,7 +540,7 @@ import Prelude
539 notElem, maximum, minimum, head, last, tail, length, null,
540 notElem, maximum, minimum, head, last, tail, length, null,
540 reverse, iterate, init, and, or, lookup, foldr1, (!!),
541 reverse, iterate, init, and, or, lookup, foldr1, (!!),
541 scanl, scanl1, replicate, concatMap, span, splitAt, break,
542 scanl, scanl1, replicate, concatMap, span, splitAt, break,
542− repeat)
543+ repeat, concat)
544import qualified Data.Heap as H
545import qualified Data.Heap as H
545import qualified Data.Map.Strict as Map
546import qualified Data.Map.Strict as Map
@@ -2567,6 +2568,17 @@ concatMapWith = K.concatMapBy
2567concatMap ::(IsStream t, Monad m) => (a -> t m b) -> t m a -> t m b
2568concatMap ::(IsStream t, Monad m) => (a -> t m b) -> t m a -> t m b
2568concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
2569concatMap f m = fromStreamD $ D.concatMap (toStreamD . f) (toStreamD m)
2571+-- | Flatten a stream of streams to a single stream.
2574+-- concat = concatMap id
2578+{-# INLINE concat #-}
2579+concat :: (IsStream t, Monad m) => t m (t m a) -> t m a
2580+concat = concatMap id
2570-- | Append the outputs of two streams, yielding all the elements from the
2582-- | Append the outputs of two streams, yielding all the elements from the
2571-- first stream and then yielding all the elements from the second stream.
2583-- first stream and then yielding all the elements from the second stream.
@@ -2705,11 +2717,13 @@ concatMapM f m = fromStreamD $ D.concatMapM (fmap toStreamD . f) (toStreamD m)
2705-- | Given a stream value in the underlying monad, lift and join the underlying
2717-- | Given a stream value in the underlying monad, lift and join the underlying
2706-- monad with the stream monad.
2718-- monad with the stream monad.
2720+-- Compare with 'concat' and 'sequence'.
2708-- /Internal/
2722-- /Internal/
2710{-# INLINE concatM #-}
2724{-# INLINE concatM #-}
2711concatM :: (IsStream t, Monad m) => m (t m a) -> t m a
2725concatM :: (IsStream t, Monad m) => m (t m a) -> t m a
2712−concatM generator = concatMapM (\() -> generator) (K.yield ())
2726+concatM generator = concatMapM (\() -> generator) (yield ())
2714-- | Like 'concatMap' but uses an 'Unfold' for stream generation. Unlike
2728-- | Like 'concatMap' but uses an 'Unfold' for stream generation. Unlike
2715-- 'concatMap' this can fuse the 'Unfold' code with the inner loop and
2729-- 'concatMap' this can fuse the 'Unfold' code with the inner loop and