dhall-nix-lib/Text/defaultMap.dhall

15 lines
428 B
Text
Raw Normal View History

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