-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathbelt_MutableMapString.resi
135 lines (105 loc) · 4.62 KB
/
belt_MutableMapString.resi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* Copyright (C) 2017 Authors of ReScript
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
type key = string
type t<'a>
let make: unit => t<'a>
let clear: t<'a> => unit
let isEmpty: t<'a> => bool
let has: (t<'a>, key) => bool
let cmpU: (t<'a>, t<'a>, (. 'a, 'a) => int) => int
/** `cmp m1 m2 cmp`
First compare by size, if size is the same,
compare by key, value pair
*/
let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int
let eqU: (t<'a>, t<'a>, (. 'a, 'a) => bool) => bool
/** `eq m1 m2 cmp` */
let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
let forEachU: (t<'a>, (. key, 'a) => unit) => unit
/** `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. */
let forEach: (t<'a>, (key, 'a) => unit) => unit
let reduceU: (t<'a>, 'b, (. 'b, key, 'a) => 'b) => 'b
/** `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. */
let reduce: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b
let everyU: (t<'a>, (. key, 'a) => bool) => bool
/** `every m p` checks if all the bindings of the map
satisfy the predicate `p`.
The application order of `p` is unspecified.
*/
let every: (t<'a>, (key, 'a) => bool) => bool
let someU: (t<'a>, (. key, 'a) => bool) => bool
/** `some m p` checks if at least one binding of the map
satisfy the predicate `p`.
The application order of `p` is unspecified.
*/
let some: (t<'a>, (key, 'a) => bool) => bool
let size: t<'a> => int
/** In increasing order */
let toList: t<'a> => list<(key, 'a)>
/** In increasing order */
let toArray: t<'a> => array<(key, 'a)>
let fromArray: array<(key, 'a)> => t<'a>
let keysToArray: t<'a> => array<key>
let valuesToArray: t<'a> => array<'a>
let minKey: t<_> => option<key>
let minKeyUndefined: t<_> => Js.undefined<key>
let maxKey: t<_> => option<key>
let maxKeyUndefined: t<_> => Js.undefined<key>
let minimum: t<'a> => option<(key, 'a)>
let minUndefined: t<'a> => Js.undefined<(key, 'a)>
let maximum: t<'a> => option<(key, 'a)>
let maxUndefined: t<'a> => Js.undefined<(key, 'a)>
let get: (t<'a>, key) => option<'a>
let getUndefined: (t<'a>, key) => Js.undefined<'a>
let getWithDefault: (t<'a>, key, 'a) => 'a
let getExn: (t<'a>, key) => 'a
/**
**raise** when invariant is not held
*/
let checkInvariantInternal: t<_> => unit
/* ************************************************************************** */
/* TODO: add functional `merge, partition, keep, split` */
/** `remove m x` do the in-place modification */
let remove: (t<'a>, key) => unit
let removeMany: (t<'a>, array<key>) => unit
/** `set m x y` do the in-place modification, return
`m` for chaining. If `x` was already bound
in `m`, its previous binding disappears. */
let set: (t<'a>, key, 'a) => unit
let updateU: (t<'a>, key, (. option<'a>) => option<'a>) => unit
let update: (t<'a>, key, option<'a> => option<'a>) => unit
let mapU: (t<'a>, (. 'a) => 'b) => t<'b>
/** `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. */
let map: (t<'a>, 'a => 'b) => t<'b>
let mapWithKeyU: (t<'a>, (. key, 'a) => 'b) => t<'b>
let mapWithKey: (t<'a>, (key, 'a) => 'b) => t<'b>