doc-src/IsarAdvanced/Codegen/Thy/examples/class.ocaml
author wenzelm
Thu, 11 Oct 2007 16:05:56 +0200
changeset 24971 4d006b03aa4a
parent 24628 33137422d7fd
child 25056 743f3603ba8b
permissions -rw-r--r--
replaced Sign.add_consts_authentic by Sign.declare_const; tuned;

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} : ('a option) null);;

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

end;; (*struct Codegen*)