26 lines
757 B
Text
26 lines
757 B
Text
λ(nix : ../NixPrelude.dhall) →
|
|
let List/concatMap = ../List/concatMap.dhall
|
|
|
|
let Map/Entry = ./Entry.dhall
|
|
|
|
let Map/Type = ./Type.dhall
|
|
|
|
let Optional/fold = ../Optional/fold.dhall nix
|
|
|
|
let unpackOptionals
|
|
: ∀(k : Type) → ∀(v : Type) → Map/Type k (Optional v) → Map/Type k v
|
|
= λ(k : Type) →
|
|
λ(v : Type) →
|
|
List/concatMap
|
|
(Map/Entry k (Optional v))
|
|
(Map/Entry k v)
|
|
( λ(e : Map/Entry k (Optional v)) →
|
|
Optional/fold
|
|
v
|
|
e.mapValue
|
|
(Map/Type k v)
|
|
(λ(v : v) → [ { mapKey = e.mapKey, mapValue = v } ])
|
|
([] : Map/Type k v)
|
|
)
|
|
|
|
in unpackOptionals
|