package dolmen_model

  1. Overview
  2. Docs
type t

The type of state

type 'a key

The type of keys into the state.

exception Error of t

Convenient exception.

exception Key_not_found of t * string * string

Exception raised by `get` when the key is not bound.

val create_key : pipe:string -> string -> _ key

create a new key

val get : 'a key -> t -> 'a

get the value associated to a key.

val get_or : default:'a -> 'a key -> t -> 'a

get the value associated to a key, or the default if the key is not bound.

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

Set the value associated to a key.

val update : 'a key -> ('a -> 'a) -> t -> t

update key f s updates the value associated with the key key according to the result of f.

  • since 0.9
val update_opt : 'a key -> ('a option -> 'a option) -> t -> t

update_opt key f s updates the value associated with the key key according to the result of f. The argument passed to f is Some v if the key is currently associated with value v, and None if the key is not bound.

  • since 0.9
val warn : ?file:_ Dolmen_loop.State.file -> ?loc:Dolmen.Std.Loc.full -> t -> 'a Dolmen_loop.Report.Warning.t -> 'a -> t

Emit a warning

val error : ?file:_ Dolmen_loop.State.file -> ?loc:Dolmen.Std.Loc.full -> t -> 'a Dolmen_loop.Report.Error.t -> 'a -> t

Emit an error.

val debug : bool key
val max_warn : int key
val cur_warn : int key
val time_limit : float key
val size_limit : float key