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