| 1 |
val rec ((((((((x)))))))) = fn () => () |
| 2 |
|
| 3 |
val _ = x () |
| 4 |
|
| 5 |
local |
| 6 |
val 'a rec f = fn () => () |
| 7 |
in |
| 8 |
end |
| 9 |
|
| 10 |
local |
| 11 |
val x = "Hello, world!\n" |
| 12 |
|
| 13 |
val x = "BUG\n" |
| 14 |
and rec f = fn () => print x |
| 15 |
in |
| 16 |
val _ = f () |
| 17 |
end |
| 18 |
|
| 19 |
local |
| 20 |
val x = "BUG\n" |
| 21 |
|
| 22 |
val x = "Hello, world!\n" |
| 23 |
and rec f = fn y => print y |
| 24 |
in |
| 25 |
val _ = f x |
| 26 |
end |
| 27 |
|
| 28 |
local |
| 29 |
val rec rec f = fn () => () |
| 30 |
in |
| 31 |
end |
| 32 |
|
| 33 |
local |
| 34 |
val rec f = fn () => () |
| 35 |
and rec g = fn () => () |
| 36 |
in |
| 37 |
end |
| 38 |
|
| 39 |
(* valrec.sml *) |
| 40 |
|
| 41 |
(* Checks parsing, scoping, typing and dynamic semantics of "val rec". *) |
| 42 |
|
| 43 |
fun x x = x |
| 44 |
val _ = |
| 45 |
case x 1 of |
| 46 |
1 => () |
| 47 |
| _ => raise Fail "bug" |
| 48 |
|
| 49 |
val a = fn x => x |
| 50 |
val a = 1 |
| 51 |
and rec b = fn x => a(b(c(d(e(f(g x)))))) |
| 52 |
and c : 'a -> 'a as d : 'a -> 'a = fn x => x |
| 53 |
and rec e as f as g = fn x => x |
| 54 |
and h : 'b -> 'b : 'b -> 'b = fn x => x; |