dhall-nix-lib/Optional/head.dhall

18 lines
468 B
Text

λ(nix : ../NixPrelude.dhall) →
let fold = ./fold.dhall nix
let head
: ∀(a : Type) → List (Optional a) → Optional a
= λ(a : Type) →
λ(xs : List (Optional a)) →
List/fold
(Optional a)
xs
(Optional a)
( λ(l : Optional a) →
λ(r : Optional a) →
fold a l (Optional a) (λ(v : a) → Some v) r
)
(None a)
in head