Mercurial > urweb
comparison tests/stuff.ur @ 244:71bafe66dbe1
Laconic -> Ur
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 08:32:18 -0400 |
parents | tests/stuff.lac@d89477f07c1e |
children |
comparison
equal
deleted
inserted
replaced
243:2b9dfaffb008 | 244:71bafe66dbe1 |
---|---|
1 type c1 = t :: Type -> t | |
2 con c2 :: Type = t :: Type -> t | |
3 con c3 = fn t :: Type => c1 | |
4 con c4 = c3 c1 | |
5 con c5 = (fn t :: Type => c1) c1 | |
6 | |
7 con name = #MyName | |
8 | |
9 con c6 = {A : c1, name : c2} | |
10 con c7 = [A = c1, name = c2] | |
11 | |
12 con c8 = fn t :: Type => t | |
13 | |
14 con c9 = {} | |
15 con c10 = ([]) :: {Type} | |
16 | |
17 val v1 = fn t :: Type => fn x : t => x | |
18 val v2 = v1 [t :: Type -> t -> t] v1 | |
19 | |
20 val r = {X = v1, Y = v2} | |
21 val v1_again = r.X | |
22 val v2_again = r.Y | |
23 | |
24 val r2 = {X = {}, Y = v2, Z = {}} | |
25 val r2_X = r2.X | |
26 val r2_Y = r2.Y | |
27 val r2_Z = r2.Z | |
28 | |
29 val f = fn fs :: {Type} => fn x : $([X = {}] ++ fs) => x.X | |
30 val f2 = fn fs :: {Type} => fn x : $(fs ++ [X = {}]) => x.X | |
31 val f3 = fn fs :: {Type} => fn x : $([X = {}, Y = {Z : {}}] ++ fs) => x.X | |
32 val f4 = fn fs :: {Type} => fn x : $([X = {}, Y = {Z : {}}] ++ fs) => x.Y | |
33 val f5 = fn fs1 :: {Type} => fn fs2 :: {Type} => fn x : $(fs1 ++ [X = {}] ++ fs2) => x.X | |
34 val f6 = fn fs1 :: {Type} => fn fs2 :: {Type} => fn x : $(fs1 ++ [X = {}] ++ fs2 ++ [Y = {Z : {}}]) => x.X | |
35 val f7 = fn fs1 :: {Type} => fn fs2 :: {Type} => fn x : $(fs1 ++ [X = {}] ++ fs2 ++ [Y = {Z : {}}]) => x.Y | |
36 | |
37 val test = f [[Y = t :: Type -> t -> t, Z = {}]] r2 | |
38 val test = f7 [[Y = t :: Type -> t -> t]] [[Z = {}]] r2 |