package prbnmcn-cgrph

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Var is the module type of variables, which are the simplest kind of input nodes available to users.

type 'a node := 'a t
type 'a t

'a t is the type of a variable holding a value of type 'a

val create : 'a -> 'a t

create x creates a variable with initial value x

val create_tracking : 'a node -> 'a t

create_tracking node creates a variable that tracks the value of node. Such a variable behaves as a normal variable except that:

  • it is initialized to the value of node at creation time
  • when the value of node changes, the variable is reset to that of node.
val peek : 'a t -> 'a

peek v returns the value currently held in the variable.

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

set v x updates the variable v to hold the value x. This automatically invalidates all nodes that depend directly and indirectly on v.

val set_with_undo : 'a t -> 'a -> undo_info

set_with_undo v x behaves as set. However, it returns a value of type undo_info holding information allowing to revert the effect of the assignement.

OCaml

Innovation. Community. Security.