dhall-nix-lib/Integer/min.dhall

17 lines
535 B
Text
Raw Normal View History

--| `min a b` returns the smaller of `a` or `b`
2022-09-07 17:10:22 +00:00
let lessThanEqual =
2022-09-14 14:51:57 +00:00
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v22.0.0/Prelude/Integer/lessThanEqual.dhall
2022-09-07 17:10:22 +00:00
sha256:e3cca9f3942f81fa78a2bea23c0c24519c67cfe438116c38e797e12dcd26f6bc
let min
: Integer → Integer → Integer
= λ(a : Integer) → λ(b : Integer) → if lessThanEqual a b then a else b
let example0 = assert : min +1 +2 ≡ +1
let example1 = assert : min +2 +1 ≡ +1
let property0 = λ(n : Integer) → assert : min n n ≡ n
in min