Skip to content

Commit f16560f

Browse files
Sync docs for belt_MutableMapInt.mli
1 parent 82f7400 commit f16560f

File tree

1 file changed

+231
-30
lines changed

1 file changed

+231
-30
lines changed

jscomp/others/belt_MutableMapInt.mli

+231-30
Original file line numberDiff line numberDiff line change
@@ -25,82 +25,247 @@
2525

2626
# 28 "others/mapm.cppo.mli"
2727
type key = int
28+
(** ```res prelude
29+
type key = int
30+
```
31+
*)
32+
2833
# 32 "others/mapm.cppo.mli"
2934
type 'a t
35+
(** ```res prelude
36+
type t<'a>
37+
```
38+
*)
3039

3140

3241
val make: unit -> 'a t
42+
(** ```res sig
43+
let make: unit => t<'a>
44+
```
45+
*)
46+
3347
val clear: 'a t -> unit
48+
(** ```res sig
49+
let clear: t<'a> => unit
50+
```
51+
*)
52+
3453
val isEmpty: 'a t -> bool
54+
(** ```res sig
55+
let isEmpty: t<'a> => bool
56+
```
57+
*)
58+
3559

3660
val has: 'a t -> key -> bool
61+
(** ```res sig
62+
let has: (t<'a>, key) => bool
63+
```
64+
*)
3765

3866
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+
3972
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.
4378
*)
4479

4580
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+
4686
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+
*)
4893

4994
val forEachU: 'a t -> (key -> 'a -> unit [@bs]) -> unit
95+
(** ```res sig
96+
let forEachU: (t<'a>, (. key, 'a) => unit) => unit
97+
```
98+
*)
99+
50100
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+
*)
55107

56108
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+
57114
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+
*)
61121

62122
val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool
123+
(** ```res sig
124+
let everyU: (t<'a>, (. key, 'a) => bool) => bool
125+
```
126+
*)
127+
63128
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.
67134
*)
68135

69136
val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool
137+
(** ```res sig
138+
let someU: (t<'a>, (. key, 'a) => bool) => bool
139+
```
140+
*)
141+
70142
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.
74148
*)
75149

76150

77151

78152

79153
val size: 'a t -> int
154+
(** ```res sig
155+
let size: t<'a> => int
156+
```
157+
*)
158+
80159
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+
*)
82166

83167
val toArray: 'a t -> (key * 'a) array
84-
(** In increasing order *)
168+
(** ```res sig
169+
let toArray: t<'a> => array<(key, 'a)>
170+
```
171+
*)
85172

86173
val fromArray: (key * 'a) array -> 'a t
174+
(** ```res sig
175+
let fromArray: array<(key, 'a)> => t<'a>
176+
```
177+
*)
178+
87179
val keysToArray: 'a t -> key array
180+
(** ```res sig
181+
let keysToArray: t<'a> => array<key>
182+
```
183+
*)
184+
88185
val valuesToArray: 'a t -> 'a array
186+
(** ```res sig
187+
let valuesToArray: t<'a> => array<'a>
188+
```
189+
*)
190+
89191
val minKey: _ t -> key option
192+
(** ```res sig
193+
let minKey: t<'a> => option<key>
194+
```
195+
*)
196+
90197
val minKeyUndefined: _ t -> key Js.undefined
198+
(** ```res sig
199+
let minKeyUndefined: t<'a> => Js.undefined<key>
200+
```
201+
*)
202+
91203
val maxKey: _ t -> key option
204+
(** ```res sig
205+
let maxKey: t<'a> => option<key>
206+
```
207+
*)
208+
92209
val maxKeyUndefined: _ t -> key Js.undefined
210+
(** ```res sig
211+
let maxKeyUndefined: t<'a> => Js.undefined<key>
212+
```
213+
*)
214+
93215
val minimum: 'a t -> (key * 'a) option
216+
(** ```res sig
217+
let minimum: t<'a> => option<(key, 'a)>
218+
```
219+
*)
220+
94221
val minUndefined: 'a t -> (key * 'a) Js.undefined
222+
(** ```res sig
223+
let minUndefined: t<'a> => Js.undefined<(key, 'a)>
224+
```
225+
*)
226+
95227
val maximum: 'a t -> (key * 'a) option
228+
(** ```res sig
229+
let maximum: t<'a> => option<(key, 'a)>
230+
```
231+
*)
232+
96233
val maxUndefined: 'a t -> (key * 'a) Js.undefined
234+
(** ```res sig
235+
let maxUndefined: t<'a> => Js.undefined<(key, 'a)>
236+
```
237+
*)
238+
97239
val get: 'a t -> key -> 'a option
240+
(** ```res sig
241+
let get: (t<'a>, key) => option<'a>
242+
```
243+
*)
244+
98245
val getUndefined: 'a t -> key -> 'a Js.undefined
246+
(** ```res sig
247+
let getUndefined: (t<'a>, key) => Js.undefined<'a>
248+
```
249+
*)
250+
99251
val getWithDefault: 'a t -> key -> 'a -> 'a
252+
(** ```res sig
253+
let getWithDefault: (t<'a>, key, 'a) => 'a
254+
```
255+
*)
256+
100257
val getExn: 'a t -> key -> 'a
258+
(** ```res sig
259+
let getExn: (t<'a>, key) => 'a
260+
```
261+
*)
262+
101263
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.
104269
*)
105270

106271

@@ -110,26 +275,62 @@ val checkInvariantInternal: _ t -> unit
110275
(*TODO: add functional `merge, partition, keep, split`*)
111276

112277
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+
*)
114284

115285
val removeMany: 'a t -> key array -> unit
286+
(** ```res sig
287+
let removeMany: (t<'a>, array<key>) => unit
288+
```
289+
*)
116290

117291
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+
*)
121298

122299
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+
123305
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+
*)
124310

125311

126312
val mapU: 'a t -> ('a -> 'b [@bs]) -> 'b t
313+
(** ```res sig
314+
let mapU: (t<'a>, (. 'a) => 'b) => t<'b>
315+
```
316+
*)
317+
127318
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+
*)
133325

134326
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+
135332
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

Comments
 (0)