doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML
author paulson
Tue, 28 Nov 2006 16:19:01 +0100
changeset 21573 8a7a68c0096c
parent 21190 08ec81dfc7fb
child 21993 4b802a9e0738
permissions -rw-r--r--
Removed the references for counting combinators. Instead they are counted in actual clauses.

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_1_:'a_1 null) (y :: xs) = y
  | head (A_1_:'a_1 null) [] = null A_1_;

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*)