dhall-nix-lib/Natural/listMin.dhall

20 lines
478 B
Text
Raw Normal View History

2022-09-01 09:40:35 +00:00
λ(nix : ../NixPrelude.dhall) →
let min = ./min.dhall
let Optional/map = ../Optional/map.dhall nix
let listMin
: List Natural → Optional Natural
= λ(xs : List Natural) →
Optional/map
Natural
Natural
( λ(n : Natural) →
if Natural/isZero n
then n
else List/fold Natural xs Natural min n
)
(List/head Natural xs)
in listMin