-
Notifications
You must be signed in to change notification settings - Fork 3
/
seal.mixml
58 lines (52 loc) · 1.32 KB
/
seal.mixml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(*) Example from RMC paper
unit RMC =
link X =
{
module A = {type t}
module B = {type u, type t, val g : t -> (u, t)}
}
with
{
module A =
{
type t = int
type u = X.B.u
val x = 666
val f(x : t) = let p = X.B.g(x + 3) in (p#1, p#2 + 5)
} :> {type t, type u = X.B.u, val x : t, val f : t -> (u, t)}
module B =
{
type u = int
type t = X.A.t
val y = A.x (*) (A.f A.x)#2 would black-out
val g(x : t) = (0, x)
} :> {type u, type t = X.A.t, val y : t, val g : t -> (u, t)}
}
module RMCmain =
link R = !RMC with {do print "RMC = "; print (R.A.f R.B.y); print "\n"}
(*) Example from RMC paper, using seals construct
unit RMC' =
link X =
{
module A = {type t}
module B = {type u, type t, val g : t -> (u, t)}
}
with
{
module A = {type t, type u = X.B.u, val x : t, val f : t -> (u, t)} seals
{
type t = int
type u = X.B.u
val x = 666
val f(x : t) = let p = X.B.g(x + 3) in (p#1, p#2 + 5)
}
module B = {type u, type t = X.A.t, val y : t, val g : t -> (u, t)} seals
{
type u = int
type t = X.A.t
val y = A.x (*) (A.f A.x)#2 would black-out
val g(x : t) = (0, x)
}
}
module RMCmain' =
link R = !RMC' with {do print "RMC' = "; print (R.A.f R.B.y); print "\n"}