doc-src/IsarAdvanced/Codegen/Thy/examples/class.ocaml
author haftmann
Tue, 18 Sep 2007 07:36:09 +0200
changeset 24618 6ab574864cd4
parent 24421 acfb2413faa3
child 24628 33137422d7fd
permissions -rw-r--r--
added script checking for consistency of ML file header

module Nat = 
struct

type nat = Suc of nat | Zero_nat;;

end;; (*struct Nat*)

module Codegen = 
struct

type 'a null = {null : 'a};;
let null _A = _A.null;;

let rec head _B = function x :: xs -> x
                  | [] -> null _B;;

let null_option () = ({null = None} : ('b option) null);;

let rec dummy
  = head (null_option ()) [Some (Nat.Suc Nat.Zero_nat); None];;

end;; (*struct Codegen*)