case checking partially working
This commit is contained in:
@@ -4,5 +4,6 @@ nat : U
|
||||
nat = {C : U} -> C -> (nat -> C) -> C
|
||||
|
||||
-- TESTCASE This was broken when I wasn't expanding Ref ty in check
|
||||
-- Also broken when I tried to put Def in VRef
|
||||
succ : nat -> nat
|
||||
succ = \n => \ z s => s n
|
||||
|
||||
21
newt/testcase.newt
Normal file
21
newt/testcase.newt
Normal file
@@ -0,0 +1,21 @@
|
||||
module Scratch
|
||||
|
||||
|
||||
|
||||
data Nat : U where
|
||||
Z : Nat
|
||||
S : Nat -> Nat
|
||||
|
||||
data Vect : Nat -> U -> U where
|
||||
Nil : {a : U} -> Vect Z a
|
||||
Cons : {a : U} {n : Nat} -> a -> Vect n a -> Vect (S n) a
|
||||
|
||||
plus : Nat -> Nat -> Nat
|
||||
plus = \ n m => case n of
|
||||
Z => m
|
||||
S k => S (plus k m)
|
||||
|
||||
length : {a : U} {n : Nat} -> Vect n a -> Nat
|
||||
length = \ v => case v of
|
||||
Nil => Z
|
||||
Cons x xs => S (length {a} xs)
|
||||
Reference in New Issue
Block a user