Module Primus.Observation

Machine Observation.

The Primus Framework is built on top of the Machine observations. The Machine components make their own observations, based on observation made by other components.

A value of type 'a observation is a first-class representation of an event of type 'a. While machine components are functors, the values of type observation should not depenend on the type of the functor.

type provider

An observation provider. A provider facilitates introspection of the Primus Machine, for the sake of debugging and dumping the effects. The provider should not (and can't be) used for affecting the behavior of a machine, or for the analysis, as its main purpose is debugging, logging, and tracing the execution.

val provide : ?desc:string -> ?inspect:( 'a -> Core_kernel.Sexp.t ) -> ?package:string -> string -> 'a observation * 'a statement

provide ?inspect name returns a pair of two handlers. The first element is used to observe values, the second is used to provide values for the observation.

The inspect function may provide a sexp representation of an observed value, that will be used for introspection and pretty-printing (it is not required, and if it is provided, it is not necessary to disclose everything

val name : 'a observation -> string

name observation is a name of the observed attribute.

val inspect : 'a observation -> 'a -> Core_kernel.Sexp.t

inspect observation value returns a sexp representation of an observed value

val list_providers : unit -> provider list

enumerate all currently available observation providers

val list : unit -> info list

list () introspects all available observations.

  • since 2.1.0
module Provider : sig ... end

Data interface to the provider.