doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML
author urbanc
Thu, 13 Sep 2007 23:58:38 +0200
changeset 24571 a6d0428dea8e
parent 24421 acfb2413faa3
child 24628 33137422d7fd
permissions -rw-r--r--
some cleaning up to do with contexts

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

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

end; (*struct Codegen*)