dhall-nix-lib/Integer/listMin.dhall

21 lines
528 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 =
https://prelude.dhall-lang.org/Optional/map.dhall
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