package streamable

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file keyed_container_clause_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
open! Base
open! Import

module type X = sig
  module Submodule_form : sig
    (** The name of the submodule, if it were to appear in the "submodule" form.
        This should be capitalized.

        Examples: "Set" for [Foo.Set.t] and "Table" for ['data Foo.Table.t].
    *)
    val name : string

    (** The number of type parameters expected, if it were to appear in the "submodule"
        form.

        Examples: 0 for [Foo.Set.t] and 1 for ['data Foo.Table.t].
    *)
    val arity : int

    (** The value types that will be expanded recursively.
        You may assume that [type_parameters] has the expected [arity].
    *)
    val value_types : type_parameters:core_type list -> core_type list
  end

  module Parameterized_form : sig
    (** The name of the module, if it were to appear in the "parameterized" form. This
        should be capitalized.

        Examples: "Set" for [('elt, 'cmp) Set.t] and "Hashtbl" for [('key, 'data) Hashtbl.t].
    *)
    val name : string

    (** The number of type parameters expected, if it were to appear in the
        "parameterized" form.

        Examples: 2 for [('elt, 'cmp) Set.t] and 3 for [('key, 'data, 'cmp) Map.t].
    *)
    val arity : int

    (** The type that is serialized atomically.
        You may assume that [type_parameters]  has the expected [arity].
    *)
    val key_type : type_parameters:core_type list -> core_type option

    (** The value types that will be expanded recursively.
        You may assume that [type_parameters] has the expected [arity].
    *)
    val value_types : type_parameters:core_type list -> core_type list
  end
end

module type Keyed_container_clause = sig
  (** Generates a matcher that operates over types of the forms:

      {[    (a1, ..., an)   K.%{Submodule_form.name}.t ]}  (the "submodule" form)
      {[ (k, a1, ..., an) %{Parameterized_form.name}.t ]}  (the "parameterized" form)

      in order to generate:

      {v
        Streamable.Of_%{String.lowercase Parameterized_form.name}
          (K)
          (<expansion of a1>)
          (...)
          (<expansion of an>)
      v}

      It is expected that values of type [K.t]/[k] can be serialized atomically.
  *)
  module Make (X : X) : sig
    val maybe_match : Clause.t
  end
end
OCaml

Innovation. Community. Security.