| author | haftmann |
| Fri, 24 Aug 2007 14:14:17 +0200 | |
| changeset 24421 | acfb2413faa3 |
| parent 23850 | f1434532a562 |
| child 24628 | 33137422d7fd |
| permissions | -rw-r--r-- |
| 22308 | 1 |
module Nat = |
2 |
struct |
|
3 |
||
| 24421 | 4 |
type nat = Suc of nat | Zero_nat;; |
| 22308 | 5 |
|
6 |
end;; (*struct Nat*) |
|
7 |
||
8 |
module Codegen = |
|
9 |
struct |
|
10 |
||
11 |
type 'a null = {null : 'a};;
|
|
12 |
let null _A = _A.null;; |
|
13 |
||
| 22798 | 14 |
let rec head _B = function x :: xs -> x |
15 |
| [] -> null _B;; |
|
| 22308 | 16 |
|
| 24421 | 17 |
let null_option () = ({null = None} : ('b option) null);;
|
| 22308 | 18 |
|
19 |
let rec dummy |
|
| 24421 | 20 |
= head (null_option ()) [Some (Nat.Suc Nat.Zero_nat); None];; |
| 22308 | 21 |
|
22 |
end;; (*struct Codegen*) |