github ↗
docs menu

Module Fehu.Info

Step metadata dictionaries.

Info dictionaries carry auxiliary data returned by Env.reset and Env.step. 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.