dhall-nix-lib/Integer/listMin.dhall

21 lines
569 B
Text
Raw Normal View History

2022-09-07 17:10:22 +00:00
let min = ./min.dhall
2022-09-07 17:10:22 +00:00
let Integer/isZero = ./isZero.dhall
2022-09-07 17:10:22 +00:00
let Optional/map =
2022-09-14 14:51:57 +00:00
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v22.0.0/Prelude/Optional/map.dhall
2022-09-07 17:10:22 +00:00
sha256:501534192d988218d43261c299cc1d1e0b13d25df388937add784778ab0054fa
2022-09-07 17:10:22 +00:00
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)
2022-09-07 17:10:22 +00:00
in listMin