Module Ref
module Ref: sig
.. end
equal t1 t2
returns true if t1
and t2
are the same ref cell.
type 'a
t = 'a Pervasives.ref
= {
}
val create : 'a -> 'a t
val (!) : 'a t -> 'a
val (:=) : 'a t -> 'a -> unit
val equal : 'a t -> 'a t -> bool
equal t1 t2
returns true if t1
and t2
are the same ref cell.
val swap : 'a t -> 'a t -> unit
swap t1 t2
swaps the values in t1
and t2
.
val replace : 'a t -> ('a -> 'a) -> unit
replace t f
is t := f !t
val with_set : 'a t -> 'a -> (unit -> 'b) -> 'b
with_set t x f
sets t
to x
and runs f x
, returning t
to its
original value once f ()
completes.