| 1 |
signature A = sig type t val a : t end |
| 2 |
|
| 3 |
functor F(A : sig type t val pr : t -> string end) = |
| 4 |
struct datatype k = A of A.t |
| 5 |
fun pr (A t) = "A(" ^ A.pr t ^ ")" |
| 6 |
end |
| 7 |
|
| 8 |
functor G(A : A) = |
| 9 |
struct type t = A.t val b = A.a end |
| 10 |
|
| 11 |
functor H(A : sig type t type s val a : s |
| 12 |
sharing type t = s |
| 13 |
val pr : t -> string |
| 14 |
end) = |
| 15 |
struct |
| 16 |
structure A1 : sig type t val pr : t -> string end = A |
| 17 |
structure A2 = F(A1) |
| 18 |
structure A3 = G(A) |
| 19 |
val a = A2.A A.a |
| 20 |
val _ = print ("value is " ^ A2.pr a ^ "\n") |
| 21 |
end |
| 22 |
|
| 23 |
structure B1 = |
| 24 |
struct |
| 25 |
datatype t = J | K |
| 26 |
type s = t |
| 27 |
val a = K |
| 28 |
fun pr K = "K" |
| 29 |
| pr J = "J" |
| 30 |
end |
| 31 |
|
| 32 |
structure B2 = |
| 33 |
struct open B1 |
| 34 |
val a = J |
| 35 |
end |
| 36 |
|
| 37 |
structure H1 = H(B1) |
| 38 |
structure H2 = H(B2) |
| 39 |
|
| 40 |
signature S = sig end |
| 41 |
|
| 42 |
functor F (): S = struct end |
| 43 |
|
| 44 |
signature S = sig val y: int end |
| 45 |
|
| 46 |
structure C = F () |