/Prelude-v19.0.0/Text/default.dhall

Copy path to clipboard

Unwrap an Optional Text value, defaulting None to ""

Examples

default (Some "ABC") ≡ "ABC"
default (None Text) ≡ ""

Source

--| Unwrap an `Optional` `Text` value, defaulting `None` to `""`
let default
: Optional Text → Text
= λ(o : Optional Text) → merge { Some = λ(t : Text) → t, None = "" } o

let example0 = assert : default (Some "ABC") ≡ "ABC"

let example1 = assert : default (None Text) ≡ ""

in default