Module Fehu.Info

Step metadata dictionaries.

Info dictionaries carry auxiliary data returned by Env.reset and Step results. Keys are strings and values are Value.t.

Types

type t

The type for info dictionaries.

Constructors

val empty : t

empty is the empty dictionary.

val of_list : (string * Value.t) list -> t

of_list kvs is a dictionary from the given key-value pairs.

Predicates

val is_empty : t -> bool

is_empty t is true iff t has no bindings.

Operations

val set : string -> Value.t -> t -> t

set k v t is t with k bound to v.

val find : string -> t -> Value.t option

find k t is the value bound to k in t, if any.

val find_exn : string -> t -> Value.t

find_exn k t is the value bound to k in t.

Raises Invalid_argument if k is not present.

val remove : string -> t -> t

remove k t is t without the binding for k.

val merge : t -> t -> t

merge a b is the union of a and b. When both have a binding for the same key, the value from b wins.

Converting

val to_list : t -> (string * Value.t) list

to_list t is the bindings of t in key order.

val to_value : t -> Value.t

to_value t is t as a Value.t.Dict.

Formatting

val pp : Stdlib.Format.formatter -> t -> unit

pp formats an info dictionary for debugging.

Convenience value constructors

val null : Value.t

null is Value.t.Null.

val bool : bool -> Value.t

bool b is Value.Bool b.

val int : int -> Value.t

int i is Value.Int i.

val float : float -> Value.t

float f is Value.Float f.

val string : string -> Value.t

string s is Value.String s.

val int_array : int array -> Value.t

int_array arr is Value.Int_array (Array.copy arr).

val float_array : float array -> Value.t

float_array arr is Value.Float_array (Array.copy arr).

val bool_array : bool array -> Value.t

bool_array arr is Value.Bool_array (Array.copy arr).