doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML
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;

structure Nat = 
struct

datatype nat = Suc of nat | Zero_nat;

end; (*struct Nat*)

structure Codegen = 
struct

type 'a null = {null : 'a};
fun null (A_:'a null) = #null A_;

fun head B_ (x :: xs) = x
  | head B_ [] = null B_;

fun null_option () = {null = NONE} : ('a option) null;

val dummy : Nat.nat option =
  head (null_option ()) [SOME (Nat.Suc Nat.Zero_nat), NONE];

end; (*struct Codegen*)