mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-19 02:41:43 +03:00
411b8ccc07
Also added (necessarily) a rule for lambdas
16 lines
311 B
Plaintext
16 lines
311 B
Plaintext
data Nat : Type where
|
|
Z : Nat
|
|
S : Nat -> Nat
|
|
|
|
AdderTy : Nat -> Type
|
|
AdderTy Z = Nat
|
|
AdderTy (S $k) = Nat -> AdderTy k
|
|
|
|
plus : Nat -> Nat -> Nat
|
|
plus Z $y = y
|
|
plus (S $k) $y = S (plus k y)
|
|
|
|
adder : (i : Nat) -> (acc : Nat) -> AdderTy i
|
|
adder Z $acc = acc
|
|
adder (S $k) $acc = \x => adder k (plus x acc)
|