author | berghofe |
Wed, 07 Feb 2007 17:30:53 +0100 | |
changeset 22264 | 6a65e9b2ae05 |
parent 22188 | a63889770d57 |
child 22386 | 4ebe883b02ff |
permissions | -rw-r--r-- |
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 |
||
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
21994
diff
changeset
|
14 |
type 'a null = {Codegen__null : 'a}; |
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
21994
diff
changeset
|
15 |
fun null (A_:'a null) = #Codegen__null A_; |
21147 | 16 |
|
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
21994
diff
changeset
|
17 |
fun head A_ (y :: xs) = y |
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
21994
diff
changeset
|
18 |
| head A_ [] = null A_; |
21147 | 19 |
|
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
21994
diff
changeset
|
20 |
val null_option : 'a option = NONE; |
21147 | 21 |
|
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
21994
diff
changeset
|
22 |
fun null_optiona () = {Codegen__null = null_option} : ('b option) null; |
21147 | 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*) |