on master help sign in
rename concatMapBy to concatMapWith
f21a5b8Harendra Kumar
examples/FileSinkServer.hs+1−1
@@ -24,7 +24,7 @@ main = do
24 (\src -> S.runFold (FH.write src)
24 (\src -> S.runFold (FH.write src)
25 $ encodeChar8Unchecked
25 $ encodeChar8Unchecked
26 $ S.concatMap A.read
26 $ S.concatMap A.read
27− $ S.concatMapBy parallel (flip NS.withSocketS recv)
27+ $ S.concatMapWith parallel (flip NS.withSocketS recv)
28 $ NS.connectionsOnAllAddrs 8090)
28 $ NS.connectionsOnAllAddrs 8090)
29
29
30 where
30 where
src/Streamly/Prelude.hs+3−3
@@ -627,7 +627,7 @@ module Streamly.Prelude
627 -- | These are variants of standard 'Foldable' fold functions that use a
627 -- | These are variants of standard 'Foldable' fold functions that use a
628 -- polymorphic stream sum operation (e.g. 'async' or 'wSerial') to fold a
628 -- polymorphic stream sum operation (e.g. 'async' or 'wSerial') to fold a
629 -- finite container of streams. Note that these are just special cases of
629 -- finite container of streams. Note that these are just special cases of
630− -- the more general 'concatMapBy' operation.
630+ -- the more general 'concatMapWith' operation.
631 --
631 --
632 , foldMapWith
632 , foldMapWith
633 , forEachWith
633 , forEachWith
@@ -657,8 +657,8 @@ module Streamly.Prelude
657 -- > filter p m = S.concatMap (\x -> if p x then S.yield x else S.nil) m
657 -- > filter p m = S.concatMap (\x -> if p x then S.yield x else S.nil) m
658 --
658 --
659
659
660− -- XXX add stateful concatMapBy
660+ -- XXX add stateful concatMapWith
661− , concatMapBy
661+ , concatMapWith
662 --, bindWith
662 --, bindWith
663 , concatMap
663 , concatMap
664 , concatMapM
664 , concatMapM
src/Streamly/Prelude/Internal.hs+22−2
@@ -232,7 +232,7 @@ module Streamly.Prelude.Internal
232 -- ** Nested Streams
232 -- ** Nested Streams
233 , concatMapM
233 , concatMapM
234 , concatMap
234 , concatMap
235− , K.concatMapBy
235+ , concatMapWith
236 -- , interposeBy
236 -- , interposeBy
237 -- , intercalate
237 -- , intercalate
238
238
@@ -2056,11 +2056,31 @@ mergeAsyncByM f m1 m2 = K.mkStream $ \st stp sng yld -> do
2056-- Nesting
2056-- Nesting
2057------------------------------------------------------------------------------
2057------------------------------------------------------------------------------
2058
2058
2059+-- | @concatMapWith merge map stream@ is a two dimensional looping combinator.
2060+-- The first argument specifies a merge or concat function that is used to
2061+-- merge the streams generated by applying the second argument i.e. the @map@
2062+-- function to each element of the input stream. The concat function could be
2063+-- 'serial', 'parallel', 'async', 'ahead' or any other zip or merge function
2064+-- and the second argument could be any stream generation function using a
2065+-- seed.
2066+--
2067+-- /Compare 'foldMapWith'/
2068+--
2069+-- @since 0.7.0
2070+{-# INLINE concatMapWith #-}
2071+concatMapWith
2072+ :: IsStream t
2073+ => (forall c. t m c -> t m c -> t m c)
2074+ -> (a -> t m b)
2075+ -> t m a
2076+ -> t m b
2077+concatMapWith = K.concatMapBy
2078+
2059-- | Map a stream producing function on each element of the stream and then
2079-- | Map a stream producing function on each element of the stream and then
2060-- flatten the results into a single stream.
2080-- flatten the results into a single stream.
2061--
2081--
2062-- @
2082-- @
2063−-- concatMap = 'concatMapBy' 'Serial.serial'
2083+-- concatMap = 'concatMapWith' 'Serial.serial'
2064-- concatMap f = 'concatMapM' (return . f)
2084-- concatMap f = 'concatMapM' (return . f)
2065-- @
2085-- @
2066--
2086--