package elpi

  1. Overview
  2. Docs

State is a collection of purely functional piece of data carried by the interpreter. Such data is kept in sync with the backtracking, i.e. changes made in a branch are lost if that branch fails. It can be used to both store custom constraints to be manipulated by custom solvers, or any other piece of data the host application may need to use.

val new_state_descriptor : unit -> Setup.state_descriptor
type 'a component

'a MUST be purely functional, i.e. backtracking is implemented by using * an old binding for 'a. * This limitation can be lifted if there is user request.

val declare : name:string -> pp:(Format.formatter -> 'a -> unit) -> init:(unit -> 'a) -> start:('a -> 'a) -> 'a component
  • deprecated Use [declare_component] instead
val declare_component : ?descriptor:Setup.state_descriptor -> name:string -> pp:(Format.formatter -> 'a -> unit) -> init:(unit -> 'a) -> start:('a -> 'a) -> unit -> 'a component
type t = Data.state
val get : 'a component -> t -> 'a
val set : 'a component -> t -> 'a -> t
val update : 'a component -> t -> ('a -> 'a) -> t

Allowed to raise BuiltInPredicate.No_clause

val update_return : 'a component -> t -> ('a -> 'a * 'b) -> t * 'b
OCaml

Innovation. Community. Security.