dhall-nix-lib/Integer/min.dhall

15 lines
408 B
Text
Raw Normal View History

--| `min a b` returns the smaller of `a` or `b`
2022-09-07 16:01:16 +00:00
let lessThanEqual = https://prelude.dhall-lang.org/Integer/lessThanEqual.dhall
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