-
-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathbelt.json
More file actions
9728 lines (9728 loc) · 394 KB
/
belt.json
File metadata and controls
9728 lines (9728 loc) · 394 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"belt": {
"id": "Belt",
"name": "Belt",
"docstrings": [
"The ReScript standard library.\n\nBelt is currently mostly covering collection types. It has no string or date functions yet, although Belt.String is in the works. In the meantime, use [Js.String](js/string) for string functions and [Js.Date](js/date) for date functions.\n\n## Motivation\n\nBelt provides:\n\n- The **highest quality** immutable data structures in JavaScript.\n- Safety by default: A Belt function will never throw exceptions, unless it is\n indicated explicitly in the function name (suffix \"Exn\").\n- Better performance and smaller code size running on the JS platform.\n- Ready for [Tree Shaking](https://webpack.js.org/guides/tree-shaking/).\n\n## Usage\n\nTo use modules from Belt, either refer to them by their fully qualified name (`Belt.List`, `Belt.Array` etc.) or open the `Belt` module by putting\n\n## Examples\n\n```rescript\nopen Belt\n```\n\nat the top of your source files. After opening Belt this way, `Array` will refer to `Belt.Array`, `List` will refer to `Belt.List` etc. in the subsequent code.\n\nIf you want to open Belt globally for all files in your project instead, you can put\n\n```json\n{\n \"compiler-flags\": [\"-open Belt\"]\n}\n```\n\ninto your `rescript.json`.\n\n**Note**: this is the **only** `open` we encourage.\n\nExample usage:\n\n## Examples\n\n```rescript\nlet someNumbers = [1, 1, 4, 2, 3, 6, 3, 4, 2]\n\nlet greaterThan2UniqueAndSorted =\n someNumbers\n ->Belt.Array.keep(x => x > 2)\n // convert to and from set to make values unique\n ->Belt.Set.Int.fromArray\n ->Belt.Set.Int.toArray // output is already sorted\n\nJs.log2(\"result\", greaterThan2UniqueAndSorted)\n```\n\n## Specialized Collections\n\nFor collections types like set or map, Belt provides both a generic module as well as specialized, more efficient implementations for string and int keys.\n\nFor example, Belt has the following set modules:\n\n- [Belt.Set](belt/set)\n- [Belt.Set.Int](belt/set/int)\n- [Belt.Set.String](belt/set/string)\n\n## Implementation Details\n\n### Array access runtime safety\n\nOne common confusion comes from the way Belt handles array access. It differs from than the default standard library's.\n\n## Examples\n\n```rescript\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0] // a == \"a\"\nlet capitalA = Js.String.toUpperCase(a)\nlet k = letters[10] // Throws an exception! The 10th index doesn't exist.\n```\n\nBecause Belt avoids exceptions and returns `options` instead, this code behaves differently:\n\n## Examples\n\n```rescript\nopen Belt\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0] // a == Some(\"a\")\nlet captialA = Js.String.toUpperCase(a) // Type error! This code will not compile.\nlet k = letters[10] // k == None\n```\n\nAlthough we've fixed the problem where `k` throws an exception, we now have a type error when trying to capitalize `a`. There are a few things going on here:\n\n- Reason transforms array index access to the function `Array.get`. So `letters[0]` is the same as `Array.get(letters, 0)`.\n- The compiler uses whichever `Array` module is in scope. If you `open Belt`, then it uses `Belt.Array`.\n- `Belt.Array.get` returns values wrapped in options, so `letters[0] == Some(\"a\")`.\n\nFortunately, this is easy to fix:\n\n## Examples\n\n```rescript\nopen Belt\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0]\n\n// Use a switch statement:\nlet capitalA = switch a {\n| Some(a) => Some(Js.String.toUpperCase(a))\n| None => None\n}\n\nlet k = letters[10] // k == None\n```\n\nWith that little bit of tweaking, our code now compiles successfully and is 100% free of runtime errors\\!\n\n### A Special Encoding for Collection Safety\n\nWhen we create a collection library for a custom data type we need a way to provide a comparator function. Take Set for example, suppose its element type is a pair of ints, it needs a custom compare function that takes two tuples and returns their order. The Set could not just be typed as Set.t (int \\* int) , its customized compare function needs to manifest itself in the signature, otherwise, if the user creates another customized compare function, the two collection could mix which would result in runtime error.\n\nWe use a phantom type to solve the problem:\n\n## Examples\n\n```rescript\nmodule Comparable1 = Belt.Id.MakeComparable({\n type t = (int, int)\n let cmp = ((a0, a1), (b0, b1)) =>\n switch Pervasives.compare(a0, b0) {\n | 0 => Pervasives.compare(a1, b1)\n | c => c\n }\n})\n\nlet mySet1 = Belt.Set.make(~id=module(Comparable1))\n\nmodule Comparable2 = Belt.Id.MakeComparable({\n type t = (int, int)\n let cmp = ((a0, a1), (b0, b1)) =>\n switch Pervasives.compare(a0, b0) {\n | 0 => Pervasives.compare(a1, b1)\n | c => c\n }\n})\n\nlet mySet2 = Belt.Set.make(~id=module(Comparable2))\n```\n\nHere, the compiler would infer `mySet1` and `mySet2` having different type, so e.g. a `merge` operation that tries to merge these two sets will correctly fail.\n\n## Examples\n\n```rescript\nlet mySet1: t<(int, int), Comparable1.identity> = %todo\nlet mySet2: t<(int, int), Comparable2.identity> = %todo\n```\n\n`Comparable1.identity` and `Comparable2.identity` are not the same using our encoding scheme."
],
"items": []
},
"belt/hashmap/string": {
"id": "Belt.HashMap.String",
"name": "String",
"docstrings": [
"Specalized when key type is `string`, more efficient than the generic type"
],
"items": [
{
"id": "Belt.HashMap.String.key",
"kind": "type",
"name": "key",
"docstrings": [],
"signature": "type key = string"
},
{
"id": "Belt.HashMap.String.t",
"kind": "type",
"name": "t",
"docstrings": [],
"signature": "type t<'b>"
},
{
"id": "Belt.HashMap.String.make",
"kind": "value",
"name": "make",
"docstrings": [],
"signature": "let make: (~hintSize: int) => t<'b>"
},
{
"id": "Belt.HashMap.String.clear",
"kind": "value",
"name": "clear",
"docstrings": [],
"signature": "let clear: t<'b> => unit"
},
{
"id": "Belt.HashMap.String.isEmpty",
"kind": "value",
"name": "isEmpty",
"docstrings": [],
"signature": "let isEmpty: t<'a> => bool"
},
{
"id": "Belt.HashMap.String.set",
"kind": "value",
"name": "set",
"docstrings": [
"`setDone(tbl, k, v)` if `k` does not exist, add the binding `k,v`, otherwise,\nupdate the old value with the new `v`"
],
"signature": "let set: (t<'a>, key, 'a) => unit"
},
{
"id": "Belt.HashMap.String.copy",
"kind": "value",
"name": "copy",
"docstrings": [],
"signature": "let copy: t<'a> => t<'a>"
},
{
"id": "Belt.HashMap.String.get",
"kind": "value",
"name": "get",
"docstrings": [],
"signature": "let get: (t<'a>, key) => option<'a>"
},
{
"id": "Belt.HashMap.String.has",
"kind": "value",
"name": "has",
"docstrings": [],
"signature": "let has: (t<'b>, key) => bool"
},
{
"id": "Belt.HashMap.String.remove",
"kind": "value",
"name": "remove",
"docstrings": [],
"signature": "let remove: (t<'a>, key) => unit"
},
{
"id": "Belt.HashMap.String.forEachU",
"kind": "value",
"name": "forEachU",
"docstrings": [],
"signature": "let forEachU: (t<'b>, (key, 'b) => unit) => unit",
"deprecated": "Use `forEach` instead"
},
{
"id": "Belt.HashMap.String.forEach",
"kind": "value",
"name": "forEach",
"docstrings": [],
"signature": "let forEach: (t<'b>, (key, 'b) => unit) => unit"
},
{
"id": "Belt.HashMap.String.reduceU",
"kind": "value",
"name": "reduceU",
"docstrings": [],
"signature": "let reduceU: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c",
"deprecated": "Use `reduce` instead"
},
{
"id": "Belt.HashMap.String.reduce",
"kind": "value",
"name": "reduce",
"docstrings": [],
"signature": "let reduce: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c"
},
{
"id": "Belt.HashMap.String.keepMapInPlaceU",
"kind": "value",
"name": "keepMapInPlaceU",
"docstrings": [],
"signature": "let keepMapInPlaceU: (t<'a>, (key, 'a) => option<'a>) => unit",
"deprecated": "Use `keepMapInPlace` instead"
},
{
"id": "Belt.HashMap.String.keepMapInPlace",
"kind": "value",
"name": "keepMapInPlace",
"docstrings": [],
"signature": "let keepMapInPlace: (t<'a>, (key, 'a) => option<'a>) => unit"
},
{
"id": "Belt.HashMap.String.size",
"kind": "value",
"name": "size",
"docstrings": [],
"signature": "let size: t<'a> => int"
},
{
"id": "Belt.HashMap.String.toArray",
"kind": "value",
"name": "toArray",
"docstrings": [],
"signature": "let toArray: t<'a> => array<(key, 'a)>"
},
{
"id": "Belt.HashMap.String.keysToArray",
"kind": "value",
"name": "keysToArray",
"docstrings": [],
"signature": "let keysToArray: t<'a> => array<key>"
},
{
"id": "Belt.HashMap.String.valuesToArray",
"kind": "value",
"name": "valuesToArray",
"docstrings": [],
"signature": "let valuesToArray: t<'a> => array<'a>"
},
{
"id": "Belt.HashMap.String.fromArray",
"kind": "value",
"name": "fromArray",
"docstrings": [],
"signature": "let fromArray: array<(key, 'a)> => t<'a>"
},
{
"id": "Belt.HashMap.String.mergeMany",
"kind": "value",
"name": "mergeMany",
"docstrings": [],
"signature": "let mergeMany: (t<'a>, array<(key, 'a)>) => unit"
},
{
"id": "Belt.HashMap.String.getBucketHistogram",
"kind": "value",
"name": "getBucketHistogram",
"docstrings": [],
"signature": "let getBucketHistogram: t<'a> => array<int>"
},
{
"id": "Belt.HashMap.String.logStats",
"kind": "value",
"name": "logStats",
"docstrings": [],
"signature": "let logStats: t<'a> => unit"
}
]
},
"belt/hashmap/int": {
"id": "Belt.HashMap.Int",
"name": "Int",
"docstrings": [
"Specalized when key type is `int`, more efficient than the generic type"
],
"items": [
{
"id": "Belt.HashMap.Int.key",
"kind": "type",
"name": "key",
"docstrings": [],
"signature": "type key = int"
},
{
"id": "Belt.HashMap.Int.t",
"kind": "type",
"name": "t",
"docstrings": [],
"signature": "type t<'b>"
},
{
"id": "Belt.HashMap.Int.make",
"kind": "value",
"name": "make",
"docstrings": [],
"signature": "let make: (~hintSize: int) => t<'b>"
},
{
"id": "Belt.HashMap.Int.clear",
"kind": "value",
"name": "clear",
"docstrings": [],
"signature": "let clear: t<'b> => unit"
},
{
"id": "Belt.HashMap.Int.isEmpty",
"kind": "value",
"name": "isEmpty",
"docstrings": [],
"signature": "let isEmpty: t<'a> => bool"
},
{
"id": "Belt.HashMap.Int.set",
"kind": "value",
"name": "set",
"docstrings": [
"`setDone(tbl, k, v)` if `k` does not exist, add the binding `k,v`, otherwise,\nupdate the old value with the new `v`"
],
"signature": "let set: (t<'a>, key, 'a) => unit"
},
{
"id": "Belt.HashMap.Int.copy",
"kind": "value",
"name": "copy",
"docstrings": [],
"signature": "let copy: t<'a> => t<'a>"
},
{
"id": "Belt.HashMap.Int.get",
"kind": "value",
"name": "get",
"docstrings": [],
"signature": "let get: (t<'a>, key) => option<'a>"
},
{
"id": "Belt.HashMap.Int.has",
"kind": "value",
"name": "has",
"docstrings": [],
"signature": "let has: (t<'b>, key) => bool"
},
{
"id": "Belt.HashMap.Int.remove",
"kind": "value",
"name": "remove",
"docstrings": [],
"signature": "let remove: (t<'a>, key) => unit"
},
{
"id": "Belt.HashMap.Int.forEachU",
"kind": "value",
"name": "forEachU",
"docstrings": [],
"signature": "let forEachU: (t<'b>, (key, 'b) => unit) => unit",
"deprecated": "Use `forEach` instead"
},
{
"id": "Belt.HashMap.Int.forEach",
"kind": "value",
"name": "forEach",
"docstrings": [],
"signature": "let forEach: (t<'b>, (key, 'b) => unit) => unit"
},
{
"id": "Belt.HashMap.Int.reduceU",
"kind": "value",
"name": "reduceU",
"docstrings": [],
"signature": "let reduceU: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c",
"deprecated": "Use `reduce` instead"
},
{
"id": "Belt.HashMap.Int.reduce",
"kind": "value",
"name": "reduce",
"docstrings": [],
"signature": "let reduce: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c"
},
{
"id": "Belt.HashMap.Int.keepMapInPlaceU",
"kind": "value",
"name": "keepMapInPlaceU",
"docstrings": [],
"signature": "let keepMapInPlaceU: (t<'a>, (key, 'a) => option<'a>) => unit",
"deprecated": "Use `keepMapInPlace` instead"
},
{
"id": "Belt.HashMap.Int.keepMapInPlace",
"kind": "value",
"name": "keepMapInPlace",
"docstrings": [],
"signature": "let keepMapInPlace: (t<'a>, (key, 'a) => option<'a>) => unit"
},
{
"id": "Belt.HashMap.Int.size",
"kind": "value",
"name": "size",
"docstrings": [],
"signature": "let size: t<'a> => int"
},
{
"id": "Belt.HashMap.Int.toArray",
"kind": "value",
"name": "toArray",
"docstrings": [],
"signature": "let toArray: t<'a> => array<(key, 'a)>"
},
{
"id": "Belt.HashMap.Int.keysToArray",
"kind": "value",
"name": "keysToArray",
"docstrings": [],
"signature": "let keysToArray: t<'a> => array<key>"
},
{
"id": "Belt.HashMap.Int.valuesToArray",
"kind": "value",
"name": "valuesToArray",
"docstrings": [],
"signature": "let valuesToArray: t<'a> => array<'a>"
},
{
"id": "Belt.HashMap.Int.fromArray",
"kind": "value",
"name": "fromArray",
"docstrings": [],
"signature": "let fromArray: array<(key, 'a)> => t<'a>"
},
{
"id": "Belt.HashMap.Int.mergeMany",
"kind": "value",
"name": "mergeMany",
"docstrings": [],
"signature": "let mergeMany: (t<'a>, array<(key, 'a)>) => unit"
},
{
"id": "Belt.HashMap.Int.getBucketHistogram",
"kind": "value",
"name": "getBucketHistogram",
"docstrings": [],
"signature": "let getBucketHistogram: t<'a> => array<int>"
},
{
"id": "Belt.HashMap.Int.logStats",
"kind": "value",
"name": "logStats",
"docstrings": [],
"signature": "let logStats: t<'a> => unit"
}
]
},
"belt/hashset/string": {
"id": "Belt.HashSet.String",
"name": "String",
"docstrings": [
"Specalized when key type is `string`, more efficient than the generic type",
"This module is [`Belt.HashSet`]() specialized with key type to be a primitive type.\n\nIt is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.HashSet`]()"
],
"items": [
{
"id": "Belt.HashSet.String.key",
"kind": "type",
"name": "key",
"docstrings": [],
"signature": "type key = string"
},
{
"id": "Belt.HashSet.String.t",
"kind": "type",
"name": "t",
"docstrings": [],
"signature": "type t"
},
{
"id": "Belt.HashSet.String.make",
"kind": "value",
"name": "make",
"docstrings": [],
"signature": "let make: (~hintSize: int) => t"
},
{
"id": "Belt.HashSet.String.clear",
"kind": "value",
"name": "clear",
"docstrings": [],
"signature": "let clear: t => unit"
},
{
"id": "Belt.HashSet.String.isEmpty",
"kind": "value",
"name": "isEmpty",
"docstrings": [],
"signature": "let isEmpty: t => bool"
},
{
"id": "Belt.HashSet.String.add",
"kind": "value",
"name": "add",
"docstrings": [],
"signature": "let add: (t, key) => unit"
},
{
"id": "Belt.HashSet.String.copy",
"kind": "value",
"name": "copy",
"docstrings": [],
"signature": "let copy: t => t"
},
{
"id": "Belt.HashSet.String.has",
"kind": "value",
"name": "has",
"docstrings": [],
"signature": "let has: (t, key) => bool"
},
{
"id": "Belt.HashSet.String.remove",
"kind": "value",
"name": "remove",
"docstrings": [],
"signature": "let remove: (t, key) => unit"
},
{
"id": "Belt.HashSet.String.forEachU",
"kind": "value",
"name": "forEachU",
"docstrings": [],
"signature": "let forEachU: (t, key => unit) => unit",
"deprecated": "Use `forEach` instead"
},
{
"id": "Belt.HashSet.String.forEach",
"kind": "value",
"name": "forEach",
"docstrings": [],
"signature": "let forEach: (t, key => unit) => unit"
},
{
"id": "Belt.HashSet.String.reduceU",
"kind": "value",
"name": "reduceU",
"docstrings": [],
"signature": "let reduceU: (t, 'c, ('c, key) => 'c) => 'c",
"deprecated": "Use `reduce` instead"
},
{
"id": "Belt.HashSet.String.reduce",
"kind": "value",
"name": "reduce",
"docstrings": [],
"signature": "let reduce: (t, 'c, ('c, key) => 'c) => 'c"
},
{
"id": "Belt.HashSet.String.size",
"kind": "value",
"name": "size",
"docstrings": [],
"signature": "let size: t => int"
},
{
"id": "Belt.HashSet.String.logStats",
"kind": "value",
"name": "logStats",
"docstrings": [],
"signature": "let logStats: t => unit"
},
{
"id": "Belt.HashSet.String.toArray",
"kind": "value",
"name": "toArray",
"docstrings": [],
"signature": "let toArray: t => array<key>"
},
{
"id": "Belt.HashSet.String.fromArray",
"kind": "value",
"name": "fromArray",
"docstrings": [],
"signature": "let fromArray: array<key> => t"
},
{
"id": "Belt.HashSet.String.mergeMany",
"kind": "value",
"name": "mergeMany",
"docstrings": [],
"signature": "let mergeMany: (t, array<key>) => unit"
},
{
"id": "Belt.HashSet.String.getBucketHistogram",
"kind": "value",
"name": "getBucketHistogram",
"docstrings": [],
"signature": "let getBucketHistogram: t => array<int>"
}
]
},
"belt/hashset/int": {
"id": "Belt.HashSet.Int",
"name": "Int",
"docstrings": [
"Specalized when key type is `int`, more efficient than the generic type",
"This module is [`Belt.HashSet`]() specialized with key type to be a primitive type.\n\nIt is more efficient in general, the API is the same with [`Belt.HashSet`]() except its key type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.HashSet`]()"
],
"items": [
{
"id": "Belt.HashSet.Int.key",
"kind": "type",
"name": "key",
"docstrings": [],
"signature": "type key = int"
},
{
"id": "Belt.HashSet.Int.t",
"kind": "type",
"name": "t",
"docstrings": [],
"signature": "type t"
},
{
"id": "Belt.HashSet.Int.make",
"kind": "value",
"name": "make",
"docstrings": [],
"signature": "let make: (~hintSize: int) => t"
},
{
"id": "Belt.HashSet.Int.clear",
"kind": "value",
"name": "clear",
"docstrings": [],
"signature": "let clear: t => unit"
},
{
"id": "Belt.HashSet.Int.isEmpty",
"kind": "value",
"name": "isEmpty",
"docstrings": [],
"signature": "let isEmpty: t => bool"
},
{
"id": "Belt.HashSet.Int.add",
"kind": "value",
"name": "add",
"docstrings": [],
"signature": "let add: (t, key) => unit"
},
{
"id": "Belt.HashSet.Int.copy",
"kind": "value",
"name": "copy",
"docstrings": [],
"signature": "let copy: t => t"
},
{
"id": "Belt.HashSet.Int.has",
"kind": "value",
"name": "has",
"docstrings": [],
"signature": "let has: (t, key) => bool"
},
{
"id": "Belt.HashSet.Int.remove",
"kind": "value",
"name": "remove",
"docstrings": [],
"signature": "let remove: (t, key) => unit"
},
{
"id": "Belt.HashSet.Int.forEachU",
"kind": "value",
"name": "forEachU",
"docstrings": [],
"signature": "let forEachU: (t, key => unit) => unit",
"deprecated": "Use `forEach` instead"
},
{
"id": "Belt.HashSet.Int.forEach",
"kind": "value",
"name": "forEach",
"docstrings": [],
"signature": "let forEach: (t, key => unit) => unit"
},
{
"id": "Belt.HashSet.Int.reduceU",
"kind": "value",
"name": "reduceU",
"docstrings": [],
"signature": "let reduceU: (t, 'c, ('c, key) => 'c) => 'c",
"deprecated": "Use `reduce` instead"
},
{
"id": "Belt.HashSet.Int.reduce",
"kind": "value",
"name": "reduce",
"docstrings": [],
"signature": "let reduce: (t, 'c, ('c, key) => 'c) => 'c"
},
{
"id": "Belt.HashSet.Int.size",
"kind": "value",
"name": "size",
"docstrings": [],
"signature": "let size: t => int"
},
{
"id": "Belt.HashSet.Int.logStats",
"kind": "value",
"name": "logStats",
"docstrings": [],
"signature": "let logStats: t => unit"
},
{
"id": "Belt.HashSet.Int.toArray",
"kind": "value",
"name": "toArray",
"docstrings": [],
"signature": "let toArray: t => array<key>"
},
{
"id": "Belt.HashSet.Int.fromArray",
"kind": "value",
"name": "fromArray",
"docstrings": [],
"signature": "let fromArray: array<key> => t"
},
{
"id": "Belt.HashSet.Int.mergeMany",
"kind": "value",
"name": "mergeMany",
"docstrings": [],
"signature": "let mergeMany: (t, array<key>) => unit"
},
{
"id": "Belt.HashSet.Int.getBucketHistogram",
"kind": "value",
"name": "getBucketHistogram",
"docstrings": [],
"signature": "let getBucketHistogram: t => array<int>"
}
]
},
"belt/mutablemap/string": {
"id": "Belt.MutableMap.String",
"name": "String",
"docstrings": [],
"items": [
{
"id": "Belt.MutableMap.String.key",
"kind": "type",
"name": "key",
"docstrings": [],
"signature": "type key = string"
},
{
"id": "Belt.MutableMap.String.t",
"kind": "type",
"name": "t",
"docstrings": [],
"signature": "type t<'a>"
},
{
"id": "Belt.MutableMap.String.make",
"kind": "value",
"name": "make",
"docstrings": [],
"signature": "let make: unit => t<'a>"
},
{
"id": "Belt.MutableMap.String.clear",
"kind": "value",
"name": "clear",
"docstrings": [],
"signature": "let clear: t<'a> => unit"
},
{
"id": "Belt.MutableMap.String.isEmpty",
"kind": "value",
"name": "isEmpty",
"docstrings": [],
"signature": "let isEmpty: t<'a> => bool"
},
{
"id": "Belt.MutableMap.String.has",
"kind": "value",
"name": "has",
"docstrings": [],
"signature": "let has: (t<'a>, key) => bool"
},
{
"id": "Belt.MutableMap.String.cmpU",
"kind": "value",
"name": "cmpU",
"docstrings": [],
"signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int",
"deprecated": "Use `cmp` instead"
},
{
"id": "Belt.MutableMap.String.cmp",
"kind": "value",
"name": "cmp",
"docstrings": [
"`cmp(m1, m2, cmp)`. First compare by size, if size is the same, compare by key,\nvalue pair"
],
"signature": "let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int"
},
{
"id": "Belt.MutableMap.String.eqU",
"kind": "value",
"name": "eqU",
"docstrings": [],
"signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool",
"deprecated": "Use `eq` instead"
},
{
"id": "Belt.MutableMap.String.eq",
"kind": "value",
"name": "eq",
"docstrings": [
"`eq(m1, m2, cmp)`"
],
"signature": "let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool"
},
{
"id": "Belt.MutableMap.String.forEachU",
"kind": "value",
"name": "forEachU",
"docstrings": [],
"signature": "let forEachU: (t<'a>, (key, 'a) => unit) => unit",
"deprecated": "Use `forEach` instead"
},
{
"id": "Belt.MutableMap.String.forEach",
"kind": "value",
"name": "forEach",
"docstrings": [
"`forEach(m, f)` applies `f` to all bindings in map `m`. `f` receives the key as\nfirst argument, and the associated value as second argument. The application \norder of `f` is in increasing order."
],
"signature": "let forEach: (t<'a>, (key, 'a) => unit) => unit"
},
{
"id": "Belt.MutableMap.String.reduceU",
"kind": "value",
"name": "reduceU",
"docstrings": [],
"signature": "let reduceU: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b",
"deprecated": "Use `reduce` instead"
},
{
"id": "Belt.MutableMap.String.reduce",
"kind": "value",
"name": "reduce",
"docstrings": [
"`reduce(m, a, f)` computes `(f kN dN ... (f k1 d1 a)...)`, where `k1 ... kN` are\nthe keys of all bindings in `m` (in increasing order), and `d1 ... dN` are the\nassociated data."
],
"signature": "let reduce: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b"
},
{
"id": "Belt.MutableMap.String.everyU",
"kind": "value",
"name": "everyU",
"docstrings": [],
"signature": "let everyU: (t<'a>, (key, 'a) => bool) => bool",
"deprecated": "Use `every` instead"
},
{
"id": "Belt.MutableMap.String.every",
"kind": "value",
"name": "every",
"docstrings": [
"`every(m, p)` checks if all the bindings of the map satisfy the predicate `p`.\nThe application order of `p` is unspecified."
],
"signature": "let every: (t<'a>, (key, 'a) => bool) => bool"
},
{
"id": "Belt.MutableMap.String.someU",
"kind": "value",
"name": "someU",
"docstrings": [],
"signature": "let someU: (t<'a>, (key, 'a) => bool) => bool",
"deprecated": "Use `some` instead"
},
{
"id": "Belt.MutableMap.String.some",
"kind": "value",
"name": "some",
"docstrings": [
"`some(m, p)` checks if at least one binding of the map satisfy the predicate `p`.\nThe application order of `p` is unspecified."
],
"signature": "let some: (t<'a>, (key, 'a) => bool) => bool"
},
{
"id": "Belt.MutableMap.String.size",
"kind": "value",
"name": "size",
"docstrings": [],
"signature": "let size: t<'a> => int"
},
{
"id": "Belt.MutableMap.String.toList",
"kind": "value",
"name": "toList",
"docstrings": [
"In increasing order"
],
"signature": "let toList: t<'a> => list<(key, 'a)>"
},
{
"id": "Belt.MutableMap.String.toArray",
"kind": "value",
"name": "toArray",
"docstrings": [
"In increasing order"
],
"signature": "let toArray: t<'a> => array<(key, 'a)>"
},
{
"id": "Belt.MutableMap.String.fromArray",
"kind": "value",
"name": "fromArray",
"docstrings": [],
"signature": "let fromArray: array<(key, 'a)> => t<'a>"
},
{
"id": "Belt.MutableMap.String.keysToArray",
"kind": "value",
"name": "keysToArray",
"docstrings": [],
"signature": "let keysToArray: t<'a> => array<key>"
},
{
"id": "Belt.MutableMap.String.valuesToArray",
"kind": "value",
"name": "valuesToArray",
"docstrings": [],
"signature": "let valuesToArray: t<'a> => array<'a>"
},
{
"id": "Belt.MutableMap.String.minKey",
"kind": "value",
"name": "minKey",
"docstrings": [],
"signature": "let minKey: t<'a> => option<key>"
},
{
"id": "Belt.MutableMap.String.minKeyUndefined",
"kind": "value",
"name": "minKeyUndefined",
"docstrings": [],
"signature": "let minKeyUndefined: t<'a> => Js.undefined<key>"
},
{
"id": "Belt.MutableMap.String.maxKey",
"kind": "value",
"name": "maxKey",
"docstrings": [],
"signature": "let maxKey: t<'a> => option<key>"
},
{
"id": "Belt.MutableMap.String.maxKeyUndefined",
"kind": "value",
"name": "maxKeyUndefined",
"docstrings": [],
"signature": "let maxKeyUndefined: t<'a> => Js.undefined<key>"
},
{
"id": "Belt.MutableMap.String.minimum",
"kind": "value",
"name": "minimum",
"docstrings": [],
"signature": "let minimum: t<'a> => option<(key, 'a)>"
},
{
"id": "Belt.MutableMap.String.minUndefined",
"kind": "value",
"name": "minUndefined",
"docstrings": [],
"signature": "let minUndefined: t<'a> => Js.undefined<(key, 'a)>"
},
{
"id": "Belt.MutableMap.String.maximum",
"kind": "value",
"name": "maximum",
"docstrings": [],
"signature": "let maximum: t<'a> => option<(key, 'a)>"
},
{
"id": "Belt.MutableMap.String.maxUndefined",
"kind": "value",
"name": "maxUndefined",
"docstrings": [],
"signature": "let maxUndefined: t<'a> => Js.undefined<(key, 'a)>"
},
{
"id": "Belt.MutableMap.String.get",
"kind": "value",
"name": "get",
"docstrings": [],
"signature": "let get: (t<'a>, key) => option<'a>"
},
{
"id": "Belt.MutableMap.String.getUndefined",
"kind": "value",
"name": "getUndefined",
"docstrings": [],
"signature": "let getUndefined: (t<'a>, key) => Js.undefined<'a>"
},
{
"id": "Belt.MutableMap.String.getWithDefault",
"kind": "value",
"name": "getWithDefault",
"docstrings": [],
"signature": "let getWithDefault: (t<'a>, key, 'a) => 'a"
},
{
"id": "Belt.MutableMap.String.getExn",
"kind": "value",
"name": "getExn",
"docstrings": [],
"signature": "let getExn: (t<'a>, key) => 'a"
},
{
"id": "Belt.MutableMap.String.getOrThrow",
"kind": "value",
"name": "getOrThrow",
"docstrings": [],
"signature": "let getOrThrow: (t<'a>, key) => 'a"
},
{
"id": "Belt.MutableMap.String.checkInvariantInternal",
"kind": "value",
"name": "checkInvariantInternal",
"docstrings": [
"**throw** when invariant is not held"
],
"signature": "let checkInvariantInternal: t<'a> => unit"
},
{
"id": "Belt.MutableMap.String.remove",
"kind": "value",
"name": "remove",
"docstrings": [
"`remove(m, x)` do the in-place modification"
],
"signature": "let remove: (t<'a>, key) => unit"
},
{
"id": "Belt.MutableMap.String.removeMany",
"kind": "value",
"name": "removeMany",
"docstrings": [],
"signature": "let removeMany: (t<'a>, array<key>) => unit"
},
{
"id": "Belt.MutableMap.String.set",
"kind": "value",
"name": "set",
"docstrings": [
"`set(m, x, y)` do the in-place modification, return `m` for chaining. If `x` was\nalready bound in `m`, its previous binding disappears."
],
"signature": "let set: (t<'a>, key, 'a) => unit"
},
{
"id": "Belt.MutableMap.String.updateU",
"kind": "value",
"name": "updateU",
"docstrings": [],
"signature": "let updateU: (t<'a>, key, option<'a> => option<'a>) => unit",
"deprecated": "Use `update` instead"
},
{
"id": "Belt.MutableMap.String.update",
"kind": "value",
"name": "update",
"docstrings": [],
"signature": "let update: (t<'a>, key, option<'a> => option<'a>) => unit"
},
{
"id": "Belt.MutableMap.String.mapU",