Module Mavkit_smart_rollup_node.Reference

Abstraction module for OCaml references

type ('perm, 'value) t

Type ('perm, 'value) t represents references containing a value of type 'value and permissions specified by 'perm.

type 'a rw = ([ `Read | `Write ], 'a) t

Read/write reference t.

type 'a ro = ([ `Read ], 'a) t

Read only reference t.

val get : (_, 'a) t -> 'a

get r returns the value held by reference r.

val set : 'a rw -> 'a -> unit

set r v sets reference r to the value v.

val map : ('a -> 'a) -> 'a rw -> unit

map r f apply f to the current value v held in the reference r.

val new_ : 'a -> (_, 'a) t

new_ v creates a fresh reference holding value v.

val readonly : (_, 'a) t -> 'a ro

readonly r casts reference r to be read only.