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