| 1 |
signature S = |
| 2 |
sig |
| 3 |
type t |
| 4 |
structure S: |
| 5 |
sig |
| 6 |
type 'a t |
| 7 |
val x: 'a t |
| 8 |
end |
| 9 |
end |
| 10 |
|
| 11 |
structure S: |
| 12 |
sig |
| 13 |
datatype ('a, 'b) t = T of 'a |
| 14 |
end = |
| 15 |
struct |
| 16 |
datatype ('b, 'a) t = T of 'b |
| 17 |
end |
| 18 |
|
| 19 |
functor F (eqtype t |
| 20 |
datatype u = U of t |
| 21 |
eqtype v |
| 22 |
sharing type t = v) = |
| 23 |
struct |
| 24 |
fun f (u: u) = u = u |
| 25 |
end |
| 26 |
|
| 27 |
functor F (type t |
| 28 |
eqtype u |
| 29 |
sharing type t = u) = |
| 30 |
struct |
| 31 |
fun f (x: t) = x = x |
| 32 |
end |
| 33 |
|
| 34 |
signature S1 = |
| 35 |
sig |
| 36 |
datatype t = T |
| 37 |
end |
| 38 |
|
| 39 |
signature S2 = |
| 40 |
sig |
| 41 |
eqtype u |
| 42 |
structure S: S1 where type t = u |
| 43 |
end; |
| 44 |
|
| 45 |
signature S1 = |
| 46 |
sig |
| 47 |
datatype t = T |
| 48 |
end |
| 49 |
|
| 50 |
signature S2 = |
| 51 |
sig |
| 52 |
datatype u = U |
| 53 |
structure S: S1 where type t = u |
| 54 |
end; |
| 55 |
|
| 56 |
signature S = |
| 57 |
sig |
| 58 |
datatype t = T |
| 59 |
end where type t = int |
| 60 |
|
| 61 |
signature S = |
| 62 |
sig |
| 63 |
type t |
| 64 |
type u |
| 65 |
type v = t |
| 66 |
sharing type u = v |
| 67 |
end |
| 68 |
|
| 69 |
signature S = |
| 70 |
sig |
| 71 |
type 'a t |
| 72 |
type 'a u |
| 73 |
type 'a v = 'a t |
| 74 |
sharing type u = v |
| 75 |
end |
| 76 |
|
| 77 |
signature S = |
| 78 |
sig |
| 79 |
type t |
| 80 |
datatype u = U |
| 81 |
sharing type u = t |
| 82 |
end |
| 83 |
|
| 84 |
signature S = |
| 85 |
sig |
| 86 |
type t |
| 87 |
structure Z: |
| 88 |
sig |
| 89 |
datatype u = U |
| 90 |
end |
| 91 |
sharing type Z.u = t |
| 92 |
end |
| 93 |
|
| 94 |
signature S = |
| 95 |
sig |
| 96 |
eqtype t |
| 97 |
structure Z: |
| 98 |
sig |
| 99 |
datatype u = U |
| 100 |
end where type u = t |
| 101 |
end |
| 102 |
|
| 103 |
structure S: |
| 104 |
sig |
| 105 |
eqtype t |
| 106 |
structure Z: |
| 107 |
sig |
| 108 |
datatype u = U |
| 109 |
end where type u = t |
| 110 |
end = |
| 111 |
struct |
| 112 |
structure Z = |
| 113 |
struct |
| 114 |
datatype u = U |
| 115 |
end |
| 116 |
type t = Z.u |
| 117 |
end |
| 118 |
|
| 119 |
functor F () = struct end |
| 120 |
|
| 121 |
functor F (type t) = struct type u = t end |
| 122 |
|
| 123 |
functor F (val x: int) = struct val y = x end |
| 124 |
|
| 125 |
functor F (structure S: sig end) = struct open S end |
| 126 |
|
| 127 |
functor F (type t |
| 128 |
type u |
| 129 |
sharing type t = u) = |
| 130 |
struct |
| 131 |
val id: t -> u = fn x => x |
| 132 |
end |
| 133 |
|
| 134 |
functor F (eqtype t) = struct fun f (x: t) = x = x end |
| 135 |
|
| 136 |
functor F (structure S: |
| 137 |
sig |
| 138 |
type t |
| 139 |
end |
| 140 |
structure T: |
| 141 |
sig |
| 142 |
type t |
| 143 |
end |
| 144 |
sharing S = T) = |
| 145 |
struct |
| 146 |
val id: S.t -> T.t = fn x => x |
| 147 |
end |
| 148 |
|
| 149 |
functor F (datatype 'a t = T of 'a * 'a) = |
| 150 |
struct |
| 151 |
val _ = T (13, 14) |
| 152 |
end |
| 153 |
|
| 154 |
functor F (type ('a, 'b) t |
| 155 |
type 'a u = ('a, int) t |
| 156 |
val f: (bool, 'b) t -> real |
| 157 |
val u: bool u) = |
| 158 |
struct |
| 159 |
val _ = f u |
| 160 |
end |
| 161 |
|
| 162 |
functor F (datatype t = T |
| 163 |
datatype u = U of t) = |
| 164 |
struct |
| 165 |
fun f (x: u) = x = x |
| 166 |
end |
| 167 |
|
| 168 |
structure S: |
| 169 |
sig |
| 170 |
val x: unit list |
| 171 |
end = |
| 172 |
struct |
| 173 |
val x = [] |
| 174 |
end |
| 175 |
|
| 176 |
structure S: |
| 177 |
sig |
| 178 |
val x: 'a list |
| 179 |
end = |
| 180 |
struct |
| 181 |
val x = [] |
| 182 |
end |
| 183 |
|
| 184 |
structure S: |
| 185 |
sig |
| 186 |
val x: ''a list |
| 187 |
end = |
| 188 |
struct |
| 189 |
val x = [] |
| 190 |
end |
| 191 |
|
| 192 |
structure S: |
| 193 |
sig |
| 194 |
val f: ''a -> ''a list |
| 195 |
end = |
| 196 |
struct |
| 197 |
fun f x = [x] |
| 198 |
end |
| 199 |
|
| 200 |
structure S: |
| 201 |
sig |
| 202 |
type 'a t |
| 203 |
|
| 204 |
val T: int t |
| 205 |
end = |
| 206 |
struct |
| 207 |
datatype 'a t = T |
| 208 |
end |
| 209 |
|
| 210 |
structure S: |
| 211 |
sig |
| 212 |
val f: 'a list -> 'a list |
| 213 |
end = |
| 214 |
struct |
| 215 |
fun f _ = [] |
| 216 |
end |
| 217 |
val z = S.f [1, 2, 3] |
| 218 |
|
| 219 |
structure S = struct datatype t = T end |
| 220 |
functor F () = S |
| 221 |
structure S1 = F () |
| 222 |
structure S2 = F () |
| 223 |
val _ = S1.T = S2.T |
| 224 |
|
| 225 |
datatype t = T |
| 226 |
functor F () = |
| 227 |
struct |
| 228 |
datatype t = datatype t |
| 229 |
end |
| 230 |
structure S1 = F () |
| 231 |
structure S2 = F () |
| 232 |
val _ = S1.T = S2.T |
| 233 |
|
| 234 |
signature SIG = sig type t end |
| 235 |
functor F (S: sig type t end): SIG = S |
| 236 |
structure S:> |
| 237 |
sig |
| 238 |
structure T: sig type t end |
| 239 |
structure U: SIG |
| 240 |
sharing type T.t = U.t |
| 241 |
end = |
| 242 |
struct |
| 243 |
structure T = struct type t = unit end |
| 244 |
structure U = F (type t = unit) |
| 245 |
end |
| 246 |
val f = fn z: S.T.t => z: S.U.t |
| 247 |
|
| 248 |
structure S:> |
| 249 |
sig |
| 250 |
eqtype t |
| 251 |
val x: t |
| 252 |
end = |
| 253 |
struct |
| 254 |
type t = unit |
| 255 |
val x = () |
| 256 |
end |
| 257 |
val _ = S.x = S.x |
| 258 |
|
| 259 |
val _ = fn x: LargeInt.int => x: IntInf.int |
| 260 |
|
| 261 |
signature S = |
| 262 |
sig |
| 263 |
type t |
| 264 |
end |
| 265 |
structure S:> S = |
| 266 |
struct |
| 267 |
datatype t = T |
| 268 |
end |
| 269 |
signature T = |
| 270 |
sig |
| 271 |
type u |
| 272 |
include S where type t = S.t |
| 273 |
end |
| 274 |
structure T:> T = |
| 275 |
struct |
| 276 |
datatype u = U |
| 277 |
type t = S.t |
| 278 |
end |
| 279 |
val _: T.t -> S.t = fn x => x |
| 280 |
|
| 281 |
signature SIG = |
| 282 |
sig |
| 283 |
type u |
| 284 |
type v = u |
| 285 |
end where type v = int |
| 286 |
structure S: SIG = |
| 287 |
struct |
| 288 |
type u = int |
| 289 |
type v = int |
| 290 |
end |
| 291 |
|
| 292 |
functor F () = |
| 293 |
struct |
| 294 |
val A = 0 |
| 295 |
end |
| 296 |
structure S = |
| 297 |
struct |
| 298 |
datatype z = A |
| 299 |
structure F = F () |
| 300 |
end |