Gist.MetaGist metadata.
Metadata is associated both to type gists and the fields of products. It allows to associate arbitrary type-dependent key-value data to the description. Gist processors can create and expose new keys to allow descriptions to influence their results. See for example the generic function metadata convention.
Since the dictionary value is polymorphic in the of the type of the gist or field you describe the interface is slightly unusual compared to a classic heterogeneous dictionary. A new 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 (struct type ('a, 'b) t = 'b fmt end)
module Meta_skip = Type.Gist.Meta.Key (struct type ('a, 'b) 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
|> Type.Gist.Meta.Min.add 0
|> Type.Gist.Meta.Max.add 255The type for metadata for types parameterized by 'p and 'f. Key values can depend on 'p and 'f. This is used for ('p, 'f) Field.t values. It allows to talk about both the product type 'p and the field type 'f.
type 'a t = ('a, 'a) t2The type for metadata for types parameterized by 'a. Key values can depend on 'a. This is used for 'a Gist.t gist values. It allows to talk about the type 'a represented by the gist.
val empty : ('a, 'b) t2empty is the empty metadata.
val is_empty : ('a, 'b) t2 -> boolis_empty m is true iff m has no bindings.
module type VALUE = sig ... endType signature to describe the type dependent value of a type.
module type KEY = sig ... endThe type for key modules.
Key (V) is a new key with values of type 'a V.t.
module Deprecated : KEY with type ('a, 'b) value := stringDeprecated is a key for indicating to processors that the type or field is subject to an @deprectated attribute with given payload
Ignore is a key for indicating to processors to ignore the type or field (they may or may not abide by it).
Immediate is a key for specifying that the type definition is subject to an [@immediate] attribute (if true).
module Immediate64 : KEY with type ('a, 'b) value := boolImmediate64 is a key for specifying that the type definition is subject to an [@immediate64] attribute (if true).
Min is a key to store a minimal value for the type or field value.
Max is a key to store a maximal value for the type or field value.