Up

module Value

: sig

Dynamic values

#
type t =
# | Unit
(*unit*)
# | Int of int64
(*integers*)
# | Bool of bool
(*booleans*)
# | Float of float
(*floating-points numbers*)
# | String of string
(*strings*)
# | Enum of t list
(*collection of values of the same type (as lists or arrays)*)
# | Tuple of t list
(*Cartesian product*)
# | Dict of (string * t) list
(*records or objects*)
# | Sum of string * t list
(*variants*)
# | Null
(*empty value for option type*)
# | Value of t
(*values for option type*)
# | Arrow of string
(*arrows; value is marshaled using Marshal.to_string*)
# | Rec of (string * int64) * t
(*Recursive value (i.e. cyclic values)*)
# | Var of (string * int64)
(*Fix-point variable for recursive value*)
# | Ext of (string * int64) * t
(*values for type variables*)

Utility functions

#
val free_vars : t -> (string * int64) list

free_vars v returns the free variables inside v. If v is obtained using value_of_t then this list should be empty

#
val equal : t -> t -> bool

Checks whether two values are equal (this looks for equivalence modulo eta-conversion on variable indices)

#
val to_string : t -> string

to_string v pretty-prints the value v

#
exception Parse_error of string

Exception raised by of_string

#
val of_string : string -> t

of_string str returns the value which had been pretty-printed to str. Raises Parse_error if str has not a valid format.

end