22 lines
506 B
Text
22 lines
506 B
Text
|
λ(nix : ../NixPrelude.dhall) →
|
||
|
let Number = ./Type.dhall
|
||
|
|
||
|
let min = ./min.dhall nix
|
||
|
|
||
|
let Number/isZero = ./isZero.dhall nix
|
||
|
|
||
|
let Optional/map = ../Optional/map.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
|