21147
|
1 |
structure ROOT =
|
|
2 |
struct
|
|
3 |
|
21190
|
4 |
structure Nat =
|
21147
|
5 |
struct
|
|
6 |
|
21190
|
7 |
datatype nat = Zero_nat | Suc of nat;
|
21147
|
8 |
|
21190
|
9 |
end; (*struct Nat*)
|
21147
|
10 |
|
|
11 |
structure Codegen =
|
|
12 |
struct
|
|
13 |
|
|
14 |
type 'a null = {null_ : 'a};
|
21190
|
15 |
fun null (A_:'a null) = #null_ A_;
|
21147
|
16 |
|
|
17 |
fun head (A_1_:'a_1 null) (y :: xs) = y
|
21190
|
18 |
| head (A_1_:'a_1 null) [] = null A_1_;
|
21147
|
19 |
|
|
20 |
val null_option : 'b option = NONE;
|
|
21 |
|
|
22 |
fun null_optiona () = {null_ = null_option} : ('b option) null
|
|
23 |
|
21190
|
24 |
val dummy : Nat.nat option =
|
|
25 |
head (null_optiona ()) [SOME (Nat.Suc Nat.Zero_nat), NONE];
|
21147
|
26 |
|
|
27 |
end; (*struct Codegen*)
|
|
28 |
|
|
29 |
end; (*struct ROOT*)
|