dhall-nix-lib/Integer/add.dhall

22 lines
506 B
Text

--| `add m n` computes `m + n`.
let Integer/subtract = ./subtract.dhall
let add
: Integer → Integer → Integer
= λ(m : Integer) → λ(n : Integer) → Integer/subtract (Integer/negate m) n
let example0 = assert : add +3 +5 ≡ +8
let example1 = assert : add -3 -5 ≡ -8
let example2 = assert : add -4 +4 ≡ +0
let example3 = assert : add -3 +5 ≡ +2
let example4 = assert : add +3 -5 ≡ -2
let example5 = assert : add +0 -3 ≡ -3
let example6 = assert : add +0 +3 ≡ +3
in add