regression/fail/functor.1.sml
raw| 1 | val b = ref false |
| 2 | val r = ref NONE |
| 3 | functor F (type t |
| 4 | val x: t |
| 5 | val f: t -> string) = |
| 6 | struct |
| 7 | val _ = |
| 8 | if !b |
| 9 | then print (concat [f (valOf (! r)), "\n"]) |
| 10 | else (b := true; r := SOME x) |
| 11 | end |
| 12 | structure S = F (type t = int |
| 13 | val x = 13 |
| 14 | val f = Int.toString) |
| 15 | structure S = F (type t = real |
| 16 | val x = 13.0 |
| 17 | val f = Real.toString) |