Haskell concatMap function (source code)

= Haskell concatMap function
{c}

= concatMap
{c}
{synonym}

The <higher-order function> with type `(a -> [b]) -> [a] -> [b]` and value `concat (map f xs)`. It replaces each input element by a <list> and concatenates those lists in input order. A direct definition is `concatMap f = foldr (\x rest -> f x ++ rest) []`. This formulation processes an input element's produced list once; it need not repeatedly append an already accumulated output prefix.