Skip to content

Commit 46468f9

Browse files
Sync docs for belt_MutableMapString.mli
1 parent f16560f commit 46468f9

File tree

1 file changed

+230
-30
lines changed

1 file changed

+230
-30
lines changed

jscomp/others/belt_MutableMapString.mli

+230-30
Original file line numberDiff line numberDiff line change
@@ -25,82 +25,246 @@
2525

2626
# 26 "others/mapm.cppo.mli"
2727
type key = string
28+
(** ```res prelude
29+
type key = string
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+
*)
3558

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

3865
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+
3971
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.
4377
*)
4478

4579
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+
4685
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+
*)
4892

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

56107
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+
57113
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+
*)
61120

62121
val everyU: 'a t -> (key -> 'a -> bool [@bs]) -> bool
122+
(** ```res sig
123+
let everyU: (t<'a>, (. key, 'a) => bool) => bool
124+
```
125+
*)
126+
63127
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.
67133
*)
68134

69135
val someU: 'a t -> (key -> 'a -> bool [@bs]) -> bool
136+
(** ```res sig
137+
let someU: (t<'a>, (. key, 'a) => bool) => bool
138+
```
139+
*)
140+
70141
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.
74147
*)
75148

76149

77150

78151

79152
val size: 'a t -> int
153+
(** ```res sig
154+
let size: t<'a> => int
155+
```
156+
*)
157+
80158
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+
*)
82165

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

86172
val fromArray: (key * 'a) array -> 'a t
173+
(** ```res sig
174+
let fromArray: array<(key, 'a)> => t<'a>
175+
```
176+
*)
177+
87178
val keysToArray: 'a t -> key array
179+
(** ```res sig
180+
let keysToArray: t<'a> => array<key>
181+
```
182+
*)
183+
88184
val valuesToArray: 'a t -> 'a array
185+
(** ```res sig
186+
let valuesToArray: t<'a> => array<'a>
187+
```
188+
*)
189+
89190
val minKey: _ t -> key option
191+
(** ```res sig
192+
let minKey: t<'a> => option<key>
193+
```
194+
*)
195+
90196
val minKeyUndefined: _ t -> key Js.undefined
197+
(** ```res sig
198+
let minKeyUndefined: t<'a> => Js.undefined<key>
199+
```
200+
*)
201+
91202
val maxKey: _ t -> key option
203+
(** ```res sig
204+
let maxKey: t<'a> => option<key>
205+
```
206+
*)
207+
92208
val maxKeyUndefined: _ t -> key Js.undefined
209+
(** ```res sig
210+
let maxKeyUndefined: t<'a> => Js.undefined<key>
211+
```
212+
*)
213+
93214
val minimum: 'a t -> (key * 'a) option
215+
(** ```res sig
216+
let minimum: t<'a> => option<(key, 'a)>
217+
```
218+
*)
219+
94220
val minUndefined: 'a t -> (key * 'a) Js.undefined
221+
(** ```res sig
222+
let minUndefined: t<'a> => Js.undefined<(key, 'a)>
223+
```
224+
*)
225+
95226
val maximum: 'a t -> (key * 'a) option
227+
(** ```res sig
228+
let maximum: t<'a> => option<(key, 'a)>
229+
```
230+
*)
231+
96232
val maxUndefined: 'a t -> (key * 'a) Js.undefined
233+
(** ```res sig
234+
let maxUndefined: t<'a> => Js.undefined<(key, 'a)>
235+
```
236+
*)
237+
97238
val get: 'a t -> key -> 'a option
239+
(** ```res sig
240+
let get: (t<'a>, key) => option<'a>
241+
```
242+
*)
243+
98244
val getUndefined: 'a t -> key -> 'a Js.undefined
245+
(** ```res sig
246+
let getUndefined: (t<'a>, key) => Js.undefined<'a>
247+
```
248+
*)
249+
99250
val getWithDefault: 'a t -> key -> 'a -> 'a
251+
(** ```res sig
252+
let getWithDefault: (t<'a>, key, 'a) => 'a
253+
```
254+
*)
255+
100256
val getExn: 'a t -> key -> 'a
257+
(** ```res sig
258+
let getExn: (t<'a>, key) => 'a
259+
```
260+
*)
261+
101262
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.
104268
*)
105269

106270

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

112276
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+
*)
114283

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

117290
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+
*)
121297

122298
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+
123304
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+
*)
124309

125310

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

134325
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+
135331
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

Comments
 (0)