1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
(* Cut down version of bug reported by Phil Clayton in SVN 1180. *)
structure RedBlackDict =
struct
type 'a maplet = string * 'a
datatype colour = Red | Black
datatype 'a tree =
Node of 'a node
| Tip
withtype 'a node = 'a tree * colour * 'a maplet * 'a tree;
datatype 'a map = Map of {t : 'a tree, bh : int};
fun min (Map {t, ...} : 'a map) : 'a maplet = (
let fun leftmost (l, _, A, _) = case l of
Node n => leftmost n
| Tip => A
in case t of
Node n => leftmost n
| Tip => raise Empty
end
)
end;
|