mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-28 11:05:17 +03:00
19 lines
426 B
Plaintext
19 lines
426 B
Plaintext
|
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
|
||
|
addBaz (plus x y) (AddThings _ _) = plus x y
|
||
|
|
||
|
-- Can't unify because of the repeated argument
|
||
|
addBaz4 : (x : Nat) -> Baz x -> Nat
|
||
|
addBaz4 (plus _ _) (AddThings x x) = plus x x
|
||
|
|