module type Local = sig
.. end
Operations on the local state required for registering a new state via
State_builder.Register
.
The local state is the mutable value which you would like to be
project-compliant.
type
t
Type of the state to register.
val create : unit -> t
How to create a new fresh state which must be equal to the initial
state: that is, if you never change the state, create ()
and get
()
must be equal (see invariant 1 below).
val clear : t -> unit
How to clear a state. After clearing, the state should be
observationally the same that after its creation (see invariant 2
below).
val get : unit -> t
How to access to the current state. Be aware of invariants 3 and 4
below.
val set : t -> unit
How to change the current state. Be aware of invariants 3 and 4
below.
The four following invariants must hold.
create ()
returns a fresh value
- forall
(p:t)
copy p
returns a fresh value
- forall
(p:t)
, create () = (clear p; set p; get ())
- forall
(p1:t),(p2:t)
such that p1 != p2
, (set p1; get ()) != s2
val clear_some_projects : (Project_skeleton.t -> bool) -> t -> bool
clear_if_project f x
must clear any value v
of type project of x
such that f v
is true
. Of course, if the type t
does not contain
any object of type project
, this function should do nothing and
safely returns fun _ -> false
.
Since Boron-20100401
Returns true
iff at least one element of x
has been cleared.