packages feed

dhall-1.6.0: Prelude/List/concatMap

{-
Tranform a list by applying a function to each element and flattening the
results

Examples:

```
./concatMap Natural Natural (λ(n : Natural) → [n, n]) [+2, +3, +5]
= [+2, +2, +3, +3, +5, +5] : List Natural

./concatMap Natural Natural (λ(n : Natural) → [n, n]) ([] : List Natural)
= [] : List Natural
```
-}
let concatMap : ∀(a : Type) → ∀(b : Type) → (a → List b) → List a → List b
    =   λ(a : Type)
    →   λ(b : Type)
    →   λ(f : a → List b)
    →   λ(xs : List a)
    →   List/build
        b
        (   λ(list : Type)
        →   λ(cons : b → list → list)
        →   List/fold a xs list (λ(x : a) → List/fold b (f x) list cons)
        )

in  concatMap