2019-05-25 20:39:21 +03:00
|
|
|
data Nat : Type where
|
|
|
|
Z : Nat
|
|
|
|
S : Nat -> Nat
|
|
|
|
|
|
|
|
plus : Nat -> Nat -> Nat
|
|
|
|
plus Z $y = y
|
|
|
|
plus (S $k) $y = S (plus k y)
|
|
|
|
|
|
|
|
data Baz : Nat -> Type where
|
|
|
|
AddThings : (x : Nat) -> (y : Nat) -> Baz (plus x y)
|
|
|
|
|
|
|
|
addBaz : (x : Nat) -> Baz x -> Nat
|
2019-07-05 01:16:08 +03:00
|
|
|
addBaz (plus x y) (AddThings _ _) = plus x y
|
2019-05-25 20:39:21 +03:00
|
|
|
|
2019-07-05 01:16:08 +03:00
|
|
|
-- Can't unify because of the repeated argument
|
2019-05-25 20:39:21 +03:00
|
|
|
addBaz4 : (x : Nat) -> Baz x -> Nat
|
2019-07-05 01:16:08 +03:00
|
|
|
addBaz4 (plus _ _) (AddThings x x) = plus x x
|
2019-05-25 20:39:21 +03:00
|
|
|
|