ansible/dhall/Prelude/Optional/all.dhall
2024-11-26 00:55:56 -05:00

16 lines
454 B
Text

{-|
Returns `False` if the supplied function returns `False` for a present element
and `True` otherwise:
-}
let all
: ∀(a : Type) → (a → Bool) → Optional a → Bool
= λ(a : Type) →
λ(f : a → Bool) →
λ(xs : Optional a) →
merge { Some = f, None = True } xs
let example0 = assert : all Natural Natural/even (Some 3) ≡ False
let example1 = assert : all Natural Natural/even (None Natural) ≡ True
in all