ModuleA.agda 454 B

1234567891011121314151617
  1. -- This module is used to illustrate how to import a non-parameterised module.
  2. module examples.syntax.ModuleA where
  3. data Nat : Set where
  4. zero : Nat
  5. suc : Nat -> Nat
  6. plus : Nat -> Nat -> Nat
  7. eval : Nat -> Nat
  8. eval zero = zero
  9. eval (suc x) = suc (eval x)
  10. eval (plus zero y) = eval y
  11. eval (plus (suc x) y) = suc (eval (plus x y))
  12. eval (plus (plus x y) z) = eval (plus x (plus y z))