Skip to content

Commit 7867f9f

Browse files
Sync docs for belt_MutableMap.mli
1 parent f1c5fcc commit 7867f9f

File tree

1 file changed

+32
-39
lines changed

1 file changed

+32
-39
lines changed

jscomp/others/belt_MutableMap.mli

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ module Int = Belt_MutableMapInt
2727
module String = Belt_MutableMapString
2828

2929

30-
(** A **mutable** sorted map module which allows customize _compare_ behavior.
30+
(** A mutable sorted map module which allows customize compare behavior.
3131
32-
Same as Belt.Map, but mutable.
32+
Same as `Belt.Map`, but mutable.
33+
*)
34+
35+
(* ```res prelude
36+
type t<'k, 'v, 'id>
37+
type id<'key, 'id> = Belt_Id.comparable<'key, 'id>
38+
```
3339
*)
3440

3541
type ('k,'v,'id) t
@@ -50,52 +56,46 @@ val cmp:
5056
('k, 'a, 'id) t ->
5157
('a -> 'a -> int ) ->
5258
int
53-
(** `cmp m1 m2 cmp`
54-
First compare by size, if size is the same,
55-
compare by key, value pair
56-
*)
59+
(** `cmp(m1, m2, cmp)` First compare by size, if size is the same, compare by
60+
key, value pair. *)
5761

5862
val eqU: ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> ('a -> 'a -> bool [@bs]) -> bool
5963
val eq: ('k, 'a, 'id) t -> ('k, 'a, 'id) t -> ('a -> 'a -> bool) -> bool
60-
(** `eq m1 m2 eqf` tests whether the maps `m1` and `m2` are
61-
equal, that is, contain equal keys and associate them with
62-
equal data. `eqf` is the equality predicate used to compare
63-
the data associated with the keys. *)
64+
(** `eq(m1, m2, eqf)` tests whether the maps `m1` and `m2` are equal, that is,
65+
contain equal keys and associate them with equal data. `eqf` is the
66+
equality predicate used to compare the data associated with the keys. *)
6467

6568
val forEachU: ('k, 'a, 'id) t -> ('k -> 'a -> unit [@bs]) -> unit
6669
val forEach: ('k, 'a, 'id) t -> ('k -> 'a -> unit) -> unit
67-
(** `forEach m f` applies `f` to all bindings in map `m`.
68-
`f` receives the 'k as first argument, and the associated value
69-
as second argument. The bindings are passed to `f` in increasing
70-
order with respect to the ordering over the type of the keys. *)
70+
(** `forEach(m, f)` applies f to all bindings in map `m`. `f` receives the `'k`
71+
as first argument, and the associated value as second argument. The
72+
bindings are passed to `f` in increasing order with respect to the ordering
73+
over the type of the keys. *)
7174

7275
val reduceU: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b [@bs]) -> 'b
7376
val reduce: ('k, 'a, 'id) t -> 'b -> ('b -> 'k -> 'a -> 'b) -> 'b
74-
(** `reduce m a f` computes `(f kN dN ... (f k1 d1 a)...)`,
75-
where `k1 ... kN` are the keys of all bindings in `m`
76-
(in increasing order), and `d1 ... dN` are the associated data. *)
77+
(** `reduce(m, a, f), computes`(f(kN, dN) ... (f(k1, d1, a))...)`, where`k1 ...
78+
kN`are the keys of all bindings in`m`(in increasing order), and`d1 ... dN`
79+
are the associated data. *)
7780

7881
val everyU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool
7982
val every: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool
80-
(** `every m p` checks if all the bindings of the map
81-
satisfy the predicate `p`.
82-
*)
83+
(** `every(m, p)` checks if all the bindings of the map satisfy the predicate
84+
`p`. *)
8385

8486

8587
val someU: ('k, 'a, 'id) t -> ('k -> 'a -> bool [@bs]) -> bool
8688
val some: ('k, 'a, 'id) t -> ('k -> 'a -> bool) -> bool
87-
(** `some m p` checks if at least one binding of the map
88-
satisfy the predicate `p`.
89-
*)
89+
(** `some(m, p)` checks if at least one binding of the map satisfy the
90+
predicate `p`. *)
9091

9192
val size: ('k, 'a, 'id) t -> int
9293

9394

9495
val toList: ('k, 'a, 'id) t -> ('k * 'a) list
95-
(** In increasing order*)
96+
(** In increasing order. *)
9697

9798
val toArray: ('k, 'a, 'id) t -> ('k * 'a) array
98-
(** In increasing order*)
9999

100100
val fromArray: ('k * 'a) array -> id:('k,'id) id -> ('k,'a,'id) t
101101
val keysToArray: ('k, _, _) t -> 'k array
@@ -114,23 +114,20 @@ val getWithDefault:
114114
('k, 'a, 'id) t -> 'k -> 'a -> 'a
115115
val getExn: ('k, 'a, 'id) t -> 'k -> 'a
116116
val checkInvariantInternal: _ t -> unit
117-
(**
118-
**raise** when invariant is not held
119-
*)
117+
(** Raise when invariant is not held. *)
120118

121119

122120
(****************************************************************************)
123121

124122
(*TODO: add functional `merge, partition, keep, split`*)
125123

126124
val remove: ('k, 'a, 'id) t -> 'k -> unit
127-
(** `remove m x` do the in-place modification,
128-
*)
125+
(** `remove(m, x)` do the in-place modification. *)
129126

130127
val removeMany: ('k, 'a, 'id) t -> 'k array -> unit
131128

132129
val set: ('k, 'a, 'id) t -> 'k -> 'a -> unit
133-
(** `set m x y ` do the in-place modification *)
130+
(** `set(m, x, y)` do the in-place modification *)
134131

135132
val updateU: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option [@bs]) -> unit
136133
val update: ('k, 'a, 'id) t -> 'k -> ('a option -> 'a option) -> unit
@@ -139,14 +136,10 @@ val mergeMany: ('k, 'a, 'id) t -> ('k * 'a) array -> unit
139136

140137
val mapU: ('k, 'a, 'id) t -> ('a -> 'b [@bs]) -> ('k ,'b,'id ) t
141138
val map: ('k, 'a, 'id) t -> ('a -> 'b) -> ('k ,'b,'id ) t
142-
(** `map m f` returns a map with same domain as `m`, where the
143-
associated value `a` of all bindings of `m` has been
144-
replaced by the result of the application of `f` to `a`.
145-
The bindings are passed to `f` in increasing order
146-
with respect to the ordering over the type of the keys. *)
139+
(** `map(m, f)` returns a map with same domain as `m`, where the associated
140+
value a of all bindings of `m` has been replaced by the result of the
141+
application of `f` to `a`. The bindings are passed to `f` in increasing
142+
order with respect to the ordering over the type of the keys. *)
147143

148144
val mapWithKeyU: ('k, 'a, 'id) t -> ('k -> 'a -> 'b [@bs]) -> ('k, 'b, 'id) t
149145
val mapWithKey: ('k, 'a, 'id) t -> ('k -> 'a -> 'b) -> ('k, 'b, 'id) t
150-
151-
152-

0 commit comments

Comments
 (0)