25
25
26
26
# 26 " others/mapm.cppo.mli"
27
27
type key = string
28
+ (* * ```res prelude
29
+ type key = string
30
+ ```
31
+ *)
32
+
28
33
# 32 " others/mapm.cppo.mli"
29
34
type 'a t
35
+ (* * ```res prelude
36
+ type t<'a>
37
+ ```
38
+ *)
30
39
31
40
32
41
val make : unit -> 'a t
42
+ (* * ```res sig
43
+ let make: unit => t<'a>
44
+ ```
45
+ *)
46
+
33
47
val clear : 'a t -> unit
48
+ (* * ```res sig
49
+ let clear: t<'a> => unit
50
+ ```
51
+ *)
52
+
34
53
val isEmpty : 'a t -> bool
54
+ (* * ```res sig
55
+ let isEmpty: t<'a> => bool
56
+ ```
57
+ *)
35
58
36
59
val has : 'a t -> key -> bool
60
+ (* * ```res sig
61
+ let has: (t<'a>, key) => bool
62
+ ```
63
+ *)
37
64
38
65
val cmpU : 'a t -> 'a t -> ('a -> 'a -> int [@ bs]) -> int
66
+ (* * ```res sig
67
+ let cmpU: (t<'a>, t<'a>, (. 'a, 'a) => int) => int
68
+ ```
69
+ *)
70
+
39
71
val cmp : 'a t -> 'a t -> ('a -> 'a -> int ) -> int
40
- (* * `cmp m1 m2 cmp`
41
- First compare by size, if size is the same,
42
- compare by key, value pair
72
+ (* * ```res sig
73
+ let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int
74
+ ```
75
+
76
+ `cmp(m1, m2, cmp)` First compare by size, if size is the same, compare by key, value pair.
43
77
*)
44
78
45
79
val eqU : 'a t -> 'a t -> ('a -> 'a -> bool [@ bs]) -> bool
80
+ (* * ```res sig
81
+ let eqU: (t<'a>, t<'a>, (. 'a, 'a) => bool) => bool
82
+ ```
83
+ *)
84
+
46
85
val eq : 'a t -> 'a t -> ('a -> 'a -> bool ) -> bool
47
- (* * `eq m1 m2 cmp` *)
86
+ (* * ```res sig
87
+ let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
88
+ ```
89
+
90
+ `eq(m1, m2, cmp)`
91
+ *)
48
92
49
93
val forEachU : 'a t -> (key -> 'a -> unit [@ bs]) -> unit
94
+ (* * ```res sig
95
+ let forEachU: (t<'a>, (. key, 'a) => unit) => unit
96
+ ```
97
+ *)
98
+
50
99
val forEach : 'a t -> (key -> 'a -> unit ) -> unit
51
- (* * `forEach m f` applies `f` to all bindings in map `m`.
52
- `f` receives the key as first argument, and the associated value
53
- as second argument.
54
- The application order of `f` is in increasing order. *)
100
+ (* * ```res sig
101
+ let forEach: (t<'a>, (key, 'a) => unit) => unit
102
+ ```
103
+
104
+ `forEach(m, f)` applies `f` to all bindings in map `m`. `f` receives the key as first argument, and the associated value as second argument. The application order of `f` is in increasing order.
105
+ *)
55
106
56
107
val reduceU : 'a t -> 'b -> ('b -> key -> 'a -> 'b [@ bs]) -> 'b
108
+ (* * ```res sig
109
+ let reduceU: (t<'a>, 'b, (. 'b, key, 'a) => 'b) => 'b
110
+ ```
111
+ *)
112
+
57
113
val reduce : 'a t -> 'b -> ('b -> key -> 'a -> 'b ) -> 'b
58
- (* * `reduce m a f` computes `(f kN dN ... (f k1 d1 a)...)`,
59
- where `k1 ... kN` are the keys of all bindings in `m`
60
- (in increasing order), and `d1 ... dN` are the associated data. *)
114
+ (* * ```res sig
115
+ let reduce: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b
116
+ ```
117
+
118
+ `reduce(m, a, f), computes`(f(kN, dN) ... (f(k1, d1, a))...)`, where`k1 ... kN`are the keys of all bindings in`m`(in increasing order), and`d1 ... dN` are the associated data.
119
+ *)
61
120
62
121
val everyU : 'a t -> (key -> 'a -> bool [@ bs]) -> bool
122
+ (* * ```res sig
123
+ let everyU: (t<'a>, (. key, 'a) => bool) => bool
124
+ ```
125
+ *)
126
+
63
127
val every : 'a t -> (key -> 'a -> bool ) -> bool
64
- (* * `every m p` checks if all the bindings of the map
65
- satisfy the predicate `p`.
66
- The application order of `p` is unspecified.
128
+ (* * ```res sig
129
+ let every: (t<'a>, (key, 'a) => bool) => bool
130
+ ```
131
+
132
+ `every(m, p)` checks if all the bindings of the map satisfy the predicate `p`. The application order of `p` is unspecified.
67
133
*)
68
134
69
135
val someU : 'a t -> (key -> 'a -> bool [@ bs]) -> bool
136
+ (* * ```res sig
137
+ let someU: (t<'a>, (. key, 'a) => bool) => bool
138
+ ```
139
+ *)
140
+
70
141
val some : 'a t -> (key -> 'a -> bool ) -> bool
71
- (* * `some m p` checks if at least one binding of the map
72
- satisfy the predicate `p`.
73
- The application order of `p` is unspecified.
142
+ (* * ```res sig
143
+ let some: (t<'a>, (key, 'a) => bool) => bool
144
+ ```
145
+
146
+ `some(m, p)` checks if at least one binding of the map satisfy the predicate `p`. The application order of `p` is unspecified.
74
147
*)
75
148
76
149
77
150
78
151
79
152
val size : 'a t -> int
153
+ (* * ```res sig
154
+ let size: t<'a> => int
155
+ ```
156
+ *)
157
+
80
158
val toList : 'a t -> (key * 'a ) list
81
- (* * In increasing order *)
159
+ (* * ```res sig
160
+ let toList: t<'a> => list<(key, 'a)>
161
+ ```
162
+
163
+ In increasing order
164
+ *)
82
165
83
166
val toArray : 'a t -> (key * 'a ) array
84
- (* * In increasing order *)
167
+ (* * ```res sig
168
+ let toArray: t<'a> => array<(key, 'a)>
169
+ ```
170
+ *)
85
171
86
172
val fromArray : (key * 'a ) array -> 'a t
173
+ (* * ```res sig
174
+ let fromArray: array<(key, 'a)> => t<'a>
175
+ ```
176
+ *)
177
+
87
178
val keysToArray : 'a t -> key array
179
+ (* * ```res sig
180
+ let keysToArray: t<'a> => array<key>
181
+ ```
182
+ *)
183
+
88
184
val valuesToArray : 'a t -> 'a array
185
+ (* * ```res sig
186
+ let valuesToArray: t<'a> => array<'a>
187
+ ```
188
+ *)
189
+
89
190
val minKey : _ t -> key option
191
+ (* * ```res sig
192
+ let minKey: t<'a> => option<key>
193
+ ```
194
+ *)
195
+
90
196
val minKeyUndefined : _ t -> key Js .undefined
197
+ (* * ```res sig
198
+ let minKeyUndefined: t<'a> => Js.undefined<key>
199
+ ```
200
+ *)
201
+
91
202
val maxKey : _ t -> key option
203
+ (* * ```res sig
204
+ let maxKey: t<'a> => option<key>
205
+ ```
206
+ *)
207
+
92
208
val maxKeyUndefined : _ t -> key Js .undefined
209
+ (* * ```res sig
210
+ let maxKeyUndefined: t<'a> => Js.undefined<key>
211
+ ```
212
+ *)
213
+
93
214
val minimum : 'a t -> (key * 'a ) option
215
+ (* * ```res sig
216
+ let minimum: t<'a> => option<(key, 'a)>
217
+ ```
218
+ *)
219
+
94
220
val minUndefined : 'a t -> (key * 'a ) Js .undefined
221
+ (* * ```res sig
222
+ let minUndefined: t<'a> => Js.undefined<(key, 'a)>
223
+ ```
224
+ *)
225
+
95
226
val maximum : 'a t -> (key * 'a ) option
227
+ (* * ```res sig
228
+ let maximum: t<'a> => option<(key, 'a)>
229
+ ```
230
+ *)
231
+
96
232
val maxUndefined : 'a t -> (key * 'a ) Js .undefined
233
+ (* * ```res sig
234
+ let maxUndefined: t<'a> => Js.undefined<(key, 'a)>
235
+ ```
236
+ *)
237
+
97
238
val get : 'a t -> key -> 'a option
239
+ (* * ```res sig
240
+ let get: (t<'a>, key) => option<'a>
241
+ ```
242
+ *)
243
+
98
244
val getUndefined : 'a t -> key -> 'a Js .undefined
245
+ (* * ```res sig
246
+ let getUndefined: (t<'a>, key) => Js.undefined<'a>
247
+ ```
248
+ *)
249
+
99
250
val getWithDefault : 'a t -> key -> 'a -> 'a
251
+ (* * ```res sig
252
+ let getWithDefault: (t<'a>, key, 'a) => 'a
253
+ ```
254
+ *)
255
+
100
256
val getExn : 'a t -> key -> 'a
257
+ (* * ```res sig
258
+ let getExn: (t<'a>, key) => 'a
259
+ ```
260
+ *)
261
+
101
262
val checkInvariantInternal : _ t -> unit
102
- (* *
103
- **raise** when invariant is not held
263
+ (* * ```res sig
264
+ let checkInvariantInternal: t<'a> => unit
265
+ ```
266
+
267
+ Raise when invariant is not held.
104
268
*)
105
269
106
270
@@ -110,26 +274,62 @@ val checkInvariantInternal: _ t -> unit
110
274
(* TODO: add functional `merge, partition, keep, split`*)
111
275
112
276
val remove : 'a t -> key -> unit
113
- (* * `remove m x` do the in-place modification *)
277
+ (* * ```res sig
278
+ let remove: (t<'a>, key) => unit
279
+ ```
280
+
281
+ `remove(m, x)` do the in-place modification.
282
+ *)
114
283
115
284
val removeMany : 'a t -> key array -> unit
285
+ (* * ```res sig
286
+ let removeMany: (t<'a>, array<key>) => unit
287
+ ```
288
+ *)
116
289
117
290
val set : 'a t -> key -> 'a -> unit
118
- (* * `set m x y` do the in-place modification, return
119
- `m` for chaining. If `x` was already bound
120
- in `m`, its previous binding disappears. *)
291
+ (* * ```res sig
292
+ let set: (t<'a>, key, 'a) => unit
293
+ ```
294
+
295
+ `set(m, x, y)` do the in-place modification, return `m` for chaining. If `x` was already bound in `m`, its previous binding disappears.
296
+ *)
121
297
122
298
val updateU : 'a t -> key -> ('a option -> 'a option [@ bs]) -> unit
299
+ (* * ```res sig
300
+ let updateU: (t<'a>, key, (. option<'a>) => option<'a>) => unit
301
+ ```
302
+ *)
303
+
123
304
val update : 'a t -> key -> ('a option -> 'a option ) -> unit
305
+ (* * ```res sig
306
+ let update: (t<'a>, key, option<'a> => option<'a>) => unit
307
+ ```
308
+ *)
124
309
125
310
126
311
val mapU : 'a t -> ('a -> 'b [@ bs]) -> 'b t
312
+ (* * ```res sig
313
+ let mapU: (t<'a>, (. 'a) => 'b) => t<'b>
314
+ ```
315
+ *)
316
+
127
317
val map : 'a t -> ('a -> 'b ) -> 'b t
128
- (* * `map m f` returns a map with same domain as `m`, where the
129
- associated value `a` of all bindings of `m` has been
130
- replaced by the result of the application of `f` to `a`.
131
- The bindings are passed to `f` in increasing order
132
- with respect to the ordering over the type of the keys. *)
318
+ (* * ```res sig
319
+ let map: (t<'a>, 'a => 'b) => t<'b>
320
+ ```
321
+
322
+ `map(m, f)` returns a map with same domain as `m`, where the associated value a of all bindings of `m` has been replaced by the result of the application of `f` to `a`. The bindings are passed to `f` in increasing order with respect to the ordering over the type of the keys.
323
+ *)
133
324
134
325
val mapWithKeyU : 'a t -> (key -> 'a -> 'b [@ bs]) -> 'b t
326
+ (* * ```res sig
327
+ let mapWithKeyU: (t<'a>, (. key, 'a) => 'b) => t<'b>
328
+ ```
329
+ *)
330
+
135
331
val mapWithKey : 'a t -> (key -> 'a -> 'b ) -> 'b t
332
+ (* * ```res sig
333
+ let mapWithKey: (t<'a>, (key, 'a) => 'b) => t<'b>
334
+ ```
335
+ *)
0 commit comments