dhall-nix-lib/Number/listMin.dhall

24 lines
620 B
Text
Raw Normal View History

λ(nix : ../NixPrelude.dhall) →
let Number = ./Type.dhall
2022-09-07 17:10:22 +00:00
let Optional/map =
https://prelude.dhall-lang.org/Optional/map.dhall
sha256:501534192d988218d43261c299cc1d1e0b13d25df388937add784778ab0054fa
let min = ./min.dhall nix
let Number/isZero = ./isZero.dhall nix
let listMin
: List Number → Optional Number
= λ(xs : List Number) →
Optional/map
Number
Number
( λ(n : Number) →
if Number/isZero n then n else List/fold Number xs Number min n
)
(List/head Number xs)
in listMin