Module Gist.Meta

Gist metadata.

Metadata, found throughout the description, allows to associate arbitrary type-dependent key-value data to the description. Processors can create and expose new keys to allow descriptions to influence their outputs.

Since the key value can depend on the type of the type you describe the interface is slightly unusual compared to a classic heterogeneous dictionary. A key is the result of a functor instantiated with the data type of the value. For example:

type 'a fmt = Format.formatter -> 'a -> unit
module Meta_fmt = Type.Gist.Meta.Key (sig type 'a t = 'f fmt end)
module Meta_skip = Type.Gist.Meta.Key (sig type 'a t = bool end)

you can then use the module's key interface to test key membership, add and remove data for the key. For example:

let meta : int Meta.t =
  Type.Gist.Meta.empty |> Meta_fmt.add Format.pp_print_int

let meta : string Meta.t =
  Type.Gist.Meta.empty |> Meta_fmt.add Format.pp_print_string
type 'a t

The type for metadata for types of type 'a. Key values can depend on 'a.

val empty : 'a t

empty is the empty metadata.

val is_empty : 'a t -> bool

is_empty m is iff m has no bindings.

module type VALUE = sig ... end

Type signature to describe the type dependent value of a type.

module type KEY = sig ... end

The type for key modules.

module Key (V : VALUE) : KEY with type 'a value = 'a V.t

Key (V) is a new key with values of type 'a V.t.