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 |
|
25056
|
17 |
let rec null_option = None;;
|
|
18 |
|
|
19 |
let null_optiona () = ({null = null_option} : ('a option) null);;
|
22308
|
20 |
|
|
21 |
let rec dummy
|
25056
|
22 |
= head (null_optiona ()) [Some (Nat.Suc Nat.Zero_nat); None];;
|
22308
|
23 |
|
|
24 |
end;; (*struct Codegen*)
|