/Prelude-v16.0.0/Text/default

Copy path to clipboard

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