doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML
author wenzelm
Fri, 19 Jan 2007 22:10:35 +0100
changeset 22124 27b674312b2f
parent 21994 dfa5133dbe73
child 22188 a63889770d57
permissions -rw-r--r--
renamed Isar/isar_output.ML to Thy/thy_output.ML; tuned messages; Antiquote.scan_arguments (moved from here); moved ML context stuff to from Context to ML_Context;

structure ROOT = 
struct

structure Nat = 
struct

datatype nat = Zero_nat | Suc of nat;

end; (*struct Nat*)

structure Codegen = 
struct

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

fun head (A_:'a null) (y :: xs) = y
  | head (A_:'a null) [] = null A_;

val null_option : 'b option = NONE;

fun null_optiona () = {null_ = null_option} : ('b option) null ;;

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

end; (*struct Codegen*)

end; (*struct ROOT*)