1 (* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
8 functor ExnHetContainer():> HET_CONTAINER =
15 pred = fn E _ => true | _ => false,
16 peek = fn E x => SOME x | _ => NONE}
20 functor RefHetContainer():> HET_CONTAINER =
22 type t = unit ref * (unit -> unit)
27 val r: 'a option ref = ref NONE
28 fun make v = (id, fn () => r := SOME v)
29 fun peek ((id', f): t) =
30 if id = id' then (f(); !r before r := NONE)
32 fun pred(id', _) = id = id'
33 in {make = make, pred = pred, peek = peek}