dhall-nix-lib/Number/listMin.dhall

24 lines
661 B
Text
Raw Normal View History

λ(nix : ../NixPrelude.dhall) →
let Number = ./Type.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
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