Hoogle Search
Within LTS Haskell 24.3 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]dimensional Numeric.Units.Dimensional.Prelude Map a function over all the elements of a container and concatenate the resulting lists.
Examples
Basic usage:>>> concatMap (take 3) [[1..], [10..], [100..], [1000..]] [1,2,3,10,11,12,100,101,102,1000,1001,1002]
>>> concatMap (take 3) (Just [1..]) [1,2,3]
concatForM :: Monad m => [a] -> (a -> m [b]) -> m [b]distribution-opensuse OpenSuse.Prelude Like concatMapM, but has its arguments flipped, so can be used instead of the common fmap concat $ forM pattern.
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]distribution-opensuse OpenSuse.Prelude Map a function over all the elements of a container and concatenate the resulting lists.
Examples
Basic usage:>>> concatMap (take 3) [[1..], [10..], [100..], [1000..]] [1,2,3,10,11,12,100,101,102,1000,1001,1002]
>>> concatMap (take 3) (Just [1..]) [1,2,3]
concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]distribution-opensuse OpenSuse.Prelude A version of concatMap that works with a monadic predicate.
-
streamly Streamly.Prelude A variant of fold that allows you to fold a Foldable container of streams using the specified stream sum operation.
concatFoldableWith async $ map return [1..3]
Equivalent to:concatFoldableWith f = Prelude.foldr f D.nil concatFoldableWith f = D.concatMapFoldableWith f id
Since: 0.8.0 (Renamed foldWith to concatFoldableWith) Since: 0.1.0 (Streamly) -
streamly Streamly.Prelude Like concatMapFoldableWith but with the last two arguments reversed i.e. the monadic streaming function is the last argument. Equivalent to:
concatForFoldableWith f xs g = Prelude.foldr (f . g) D.nil xs concatForFoldableWith f = flip (D.concatMapFoldableWith f)
Since: 0.8.0 (Renamed forEachWith to concatForFoldableWith) Since: 0.1.0 (Streamly) -
streamly Streamly.Prelude Map a stream producing function on each element of the stream and then flatten the results into a single stream.
>>> concatMap f = Stream.concatMapM (return . f) >>> concatMap f = Stream.concatMapWith Stream.serial f >>> concatMap f = Stream.concat . Stream.map f
-
streamly Streamly.Prelude A variant of foldMap that allows you to map a monadic streaming action on a Foldable container and then fold it using the specified stream merge operation.
concatMapFoldableWith async return [1..3]
Equivalent to:concatMapFoldableWith f g = Prelude.foldr (f . g) S.nil concatMapFoldableWith f g xs = S.concatMapWith f g (S.fromFoldable xs)
Since: 0.8.0 (Renamed foldMapWith to concatMapFoldableWith) Since: 0.1.0 (Streamly) concatMapM :: (IsStream t, Monad m) => (a -> m (t m b)) -> t m a -> t m bstreamly Streamly.Prelude Map a stream producing monadic function on each element of the stream and then flatten the results into a single stream. Since the stream generation function is monadic, unlike concatMap, it can produce an effect at the beginning of each iteration of the inner loop.
-
streamly Streamly.Prelude concatMapWith mixer generator stream is a two dimensional looping combinator. The generator function is used to generate streams from the elements in the input stream and the mixer function is used to merge those streams. Note we can merge streams concurrently by using a concurrent merge function. Since: 0.7.0 Since: 0.8.0 (signature change)