Module Base__Ref
Module for the type ref
, mutable indirection cells r
containing a value of type 'a
, accessed with !r
and set by r := a
.
type 'a t
= 'a Base__.Import.Caml.ref
=
{
mutable contents : 'a;
}
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
include Base.Sexpable.S1 with type 'a t := 'a t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
val t_sexp_grammar : Base.Sexp.Private.Raw_grammar.t
val replace : 'a t -> ('a -> 'a) -> unit
replace t f
ist := f !t
val set_temporarily : 'a t -> 'a -> f:(unit -> 'b) -> 'b
set_temporarily t a ~f
setst
toa
, callsf ()
, and then restorest
to its value prior toset_temporarily
being called, whetherf
returns or raises.
module And_value : sig ... end
val sets_temporarily : And_value.t list -> f:(unit -> 'a) -> 'a
sets_temporarily [ ...; T (ti, ai); ... ] ~f
sets eachti
toai
, callsf ()
, and then restores allti
to their value prior tosets_temporarily
being called, whetherf
returns or raises.