doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML
author haftmann
Tue, 18 Sep 2007 07:36:09 +0200
changeset 24618 6ab574864cd4
parent 24421 acfb2413faa3
child 24628 33137422d7fd
permissions -rw-r--r--
added script checking for consistency of ML file header

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