mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-18 16:51:51 +03:00
16 lines
350 B
Plaintext
16 lines
350 B
Plaintext
|
data Nat : Type where
|
||
|
Z : Nat
|
||
|
S : Nat -> Nat
|
||
|
|
||
|
data Vect : Nat -> Type -> Type where
|
||
|
Nil : Vect Z $a
|
||
|
Cons : $a -> Vect $k $a -> Vect (S $k) $a
|
||
|
|
||
|
plus : Nat -> Nat -> Nat
|
||
|
plus Z $y = y
|
||
|
plus (S $k) $y = S (plus k y)
|
||
|
|
||
|
append : Vect $n $a -> Vect $m $a -> Vect (plus $n $m) $a
|
||
|
append Nil $ys = ys
|
||
|
append (Cons $x $xs) $ys = Cons x ?foo
|