dhall-nix-lib/Integer/equal.dhall

22 lines
570 B
Text
Raw Normal View History

2022-09-01 08:05:34 +00:00
--| `equal` checks if two Integers are equal.
let Natural/equal = ../Natural/equal.dhall
let equal
: Integer → Integer → Bool
= λ(a : Integer) →
λ(b : Integer) →
Natural/equal (Integer/clamp a) (Integer/clamp b)
&& Natural/equal
(Integer/clamp (Integer/negate a))
(Integer/clamp (Integer/negate b))
let example0 = assert : equal +5 +5 ≡ True
let example1 = assert : equal +5 +6 ≡ False
let example2 = assert : equal +5 -5 ≡ False
let example3 = assert : equal -5 -5 ≡ True
in equal