dhall-nix-lib/Number/listMin.dhall

23 lines
661 B
Text

λ(nix : ../NixPrelude.dhall) →
let Number = ./Type.dhall
let Optional/map =
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v22.0.0/Prelude/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