dhall-nix-lib/Integer/listMin.dhall

20 lines
569 B
Text

let min = ./min.dhall
let Integer/isZero = ./isZero.dhall
let Optional/map =
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v22.0.0/Prelude/Optional/map.dhall
sha256:501534192d988218d43261c299cc1d1e0b13d25df388937add784778ab0054fa
let listMin
: List Integer → Optional Integer
= λ(xs : List Integer) →
Optional/map
Integer
Integer
( λ(n : Integer) →
if Integer/isZero n then n else List/fold Integer xs Integer min n
)
(List/head Integer xs)
in listMin