Backport from sid to buster
[hcoop/debian/mlton.git] / regression / abstype.sml
CommitLineData
7f918cf1
CE
1abstype t = T
2with
3 val eq = op =
4end
5val _ = eq (3, 3)
6
7abstype t = T
8with
9 val t = T
10 val eq = op =
11end
12val _ = eq (t, t)
13
14abstype t = T
15with
16 val t = T
17 val eq = op =
18 val _ = eq (t, t)
19end
20val _ = eq (2, 3)
21
22abstype t = T
23with
24 val t = T
25 val eq = op =
26 val _ = eq (t, t)
27end
28val _ = eq (t, t)
29
30abstype t = T
31with
32 val t = T
33 val eq = op =
34 val _ = eq (t, t) andalso eq (2, 3)
35end
36val _ = eq (2, 3)
37
38(* with abstype *)
39
40structure S =
41 struct
42 abstype s = S
43 with
44 val a = S
45 end
46 end
47
48signature F =
49 sig
50 val b : S.s
51 end
52
53functor F() : F =
54 struct
55 type s = S.s
56 val b = S.a
57 end
58
59
60functor K() =
61 struct
62 structure F = F()
63 end
64
65structure K = K()
66
67(* abstype.sml *)
68
69(* Checks equality inferred for abstype environments. *)
70
71abstype t = T with
72 datatype u = U of t
73 val eq = op=
74end
75
76fun eq1(t1, t2) = U t1 = U t2;
77fun eq2(t1, t2 : t) = eq(t1, t2);