dhall-nix-lib/Text/defaultMap.dhall
2022-09-02 10:03:27 +01:00

14 lines
428 B
Text

--| Transform the value in an `Optional` into `Text`, defaulting `None` to `""`
λ(nix : ../NixPrelude.dhall) →
let Optional/map = ../Optional/map.dhall nix
let default = ./default.dhall nix
let defaultMap
: ∀(a : Type) → (a → Text) → Optional a → Text
= λ(a : Type) →
λ(f : a → Text) →
λ(o : Optional a) →
default (Optional/map a Text f o)
in defaultMap