Mercurial > urweb
comparison tests/constraint.ur @ 244:71bafe66dbe1
Laconic -> Ur
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 08:32:18 -0400 |
parents | tests/constraint.lac@d3ee072fa609 |
children |
comparison
equal
deleted
inserted
replaced
243:2b9dfaffb008 | 244:71bafe66dbe1 |
---|---|
1 signature S = sig | |
2 con nm :: Name | |
3 con r :: {Type} | |
4 | |
5 constraint [nm] ~ r | |
6 end | |
7 | |
8 structure M : S = struct | |
9 con nm = #A | |
10 con r = [B = float, C = string] | |
11 | |
12 constraint [A] ~ [B] | |
13 constraint [nm] ~ r | |
14 constraint [C] ~ [D] | |
15 end | |
16 | |
17 structure M' = struct | |
18 open M | |
19 | |
20 con combo = [nm = int] ++ r | |
21 end | |
22 | |
23 structure M' = struct | |
24 open constraints M | |
25 | |
26 con nm' = M.nm | |
27 con r' = M.r | |
28 con combo = [nm' = int] ++ r' | |
29 end | |
30 | |
31 | |
32 signature S' = sig | |
33 con r1 :: {Type} | |
34 con r2 :: {Type} | |
35 | |
36 constraint r1 ~ r2 | |
37 end | |
38 | |
39 functor F (M : S) : S' = struct | |
40 con r1 = [M.nm = int] | |
41 con r2 = M.r | |
42 | |
43 open constraints M | |
44 constraint r1 ~ r2 | |
45 end |