dhall-nix-lib/Double/listMin.dhall

19 lines
477 B
Text

λ(nix : ../NixPrelude.dhall) →
let min = ./min.dhall nix
let Double/isZero = ./isZero.dhall nix
let Optional/map = ../Optional/map.dhall nix
let listMin
: List Double → Optional Double
= λ(xs : List Double) →
Optional/map
Double
Double
( λ(n : Double) →
if Double/isZero n then n else List/fold Double xs Double min n
)
(List/head Double xs)
in listMin