Idris2/tests/ttimp/nest001/Let.yaff
Edwin Brady a972778eab Add test script
They don't all pass yet, for minor reasons. Coming shortly...
Unfortunately the startup overhead for chez is really noticeable here!
2020-05-19 18:25:18 +01:00

43 lines
897 B
Plaintext

testlet : Integer -> Integer
testlet $x = let y = prim__add_Integer x x in
prim__add_Integer y y
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)
fn2 : Nat -> Nat -> Nat
fn2 $x $y
= let w : Nat
w = plus x x;
help : Nat -> Nat
help $z = plus z w in
plus (help y) w
fn : Nat -> Nat -> Nat
fn $x $y
= let w : ?; w = plus x x in
let foo = plus x x in
let help : Nat -> Nat;
help $z = plus z w in
plus (help y) foo
localdata : Nat -> Nat
localdata $var =
let data Bool : Type where
False : Bool
True : Bool
isS : Nat -> Bool
isS Z = False
isS (S $k) = True
boolToNat : Bool -> Nat
boolToNat False = Z
boolToNat True = S var in
boolToNat (isS var)