dhall-nix-lib/Natural/listMax.dhall

15 lines
379 B
Text

λ(nix : ../NixPrelude.dhall) →
let max = ./max.dhall
let Optional/map = ../Optional/map.dhall nix
let listMax
: List Natural → Optional Natural
= λ(xs : List Natural) →
Optional/map
Natural
Natural
(λ(n : Natural) → List/fold Natural xs Natural max n)
(List/head Natural xs)
in listMax