blob: 5adfb5976b7f3deddd17075732e8a0ab7b2a7488 (
plain)
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
|
signature S = sig
type t
val z : t
val s : t -> t
end
signature T = sig
type t
val three : t
end
functor F (M : S) : T where type t = M.t = struct
type t = M.t
val three = M.s (M.s (M.s M.z))
end
structure O = F (struct
type t = int
val z = 0
val s = fn x : t => x
end)
val three : int = O.three
structure S = struct
type t = int
val z = 0
val s = fn x : t => x
end
structure SO = F (S)
val three : int = SO.three
structure SS : S = S
structure SSO = F (SS)
val three : SS.t = SSO.three
val main = three
|