|
369 | 369 | "id": "Belt.HashSet.String",
|
370 | 370 | "name": "String",
|
371 | 371 | "docstrings": [
|
372 |
| - "Specalized when key type is `string`, more efficient than the generic type" |
| 372 | + "Specalized when key type is `string`, more efficient than the generic type", |
| 373 | + "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`]()" |
373 | 374 | ],
|
374 | 375 | "items": [
|
375 | 376 | {
|
|
511 | 512 | "id": "Belt.HashSet.Int",
|
512 | 513 | "name": "Int",
|
513 | 514 | "docstrings": [
|
514 |
| - "Specalized when key type is `int`, more efficient than the generic type" |
| 515 | + "Specalized when key type is `int`, more efficient than the generic type", |
| 516 | + "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`]()" |
515 | 517 | ],
|
516 | 518 | "items": [
|
517 | 519 | {
|
|
1359 | 1361 | "id": "Belt.MutableSet.String",
|
1360 | 1362 | "name": "String",
|
1361 | 1363 | "docstrings": [
|
1362 |
| - "Specialized when key type is `string`, more efficient than the generic type" |
| 1364 | + "Specialized when key type is `string`, more efficient than the generic type", |
| 1365 | + "This module is [`Belt.MutableSet`]() specialized with key type to be a primitive type.\n\nIt is more efficient in general, the API is the same with [`Belt.MutableSet`]() except its key type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.MutableSet`]()" |
1363 | 1366 | ],
|
1364 | 1367 | "items": [
|
1365 | 1368 | {
|
|
1700 | 1703 | "id": "Belt.MutableSet.Int",
|
1701 | 1704 | "name": "Int",
|
1702 | 1705 | "docstrings": [
|
1703 |
| - "Specialized when key type is `int`, more efficient than the generic type" |
| 1706 | + "Specialized when key type is `int`, more efficient than the generic type", |
| 1707 | + "This module is [`Belt.MutableSet`]() specialized with key type to be a primitive type.\n\nIt is more efficient in general, the API is the same with [`Belt.MutableSet`]() except its key type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.MutableSet`]()" |
1704 | 1708 | ],
|
1705 | 1709 | "items": [
|
1706 | 1710 | {
|
|
2040 | 2044 | "belt/map/dict": {
|
2041 | 2045 | "id": "Belt.Map.Dict",
|
2042 | 2046 | "name": "Dict",
|
2043 |
| - "docstrings": [], |
| 2047 | + "docstrings": [ |
| 2048 | + "This module separates identity from data, it is a bit more verbose but\nslightly more efficient due to the fact that there is no need to pack\nidentity and data back after each operation.\n\n**_Advanced usage only_**" |
| 2049 | + ], |
2044 | 2050 | "items": [
|
2045 | 2051 | {
|
2046 | 2052 | "id": "Belt.Map.Dict.t",
|
|
3311 | 3317 | "id": "Belt.Set.Dict",
|
3312 | 3318 | "name": "Dict",
|
3313 | 3319 | "docstrings": [
|
3314 |
| - "This module separates identity from data, it is a bit more verbose but slightly\nmore efficient due to the fact that there is no need to pack identity and data back\nafter each operation" |
| 3320 | + "This module separates identity from data, it is a bit more verbose but slightly\nmore efficient due to the fact that there is no need to pack identity and data back\nafter each operation", |
| 3321 | + "This module separates identity from data. It is a bit more verbose but slightly\nmore efficient due to the fact that there is no need to pack identity and data\nback after each operation." |
3315 | 3322 | ],
|
3316 | 3323 | "items": [
|
3317 | 3324 | {
|
|
3679 | 3686 | "id": "Belt.Set.String",
|
3680 | 3687 | "name": "String",
|
3681 | 3688 | "docstrings": [
|
3682 |
| - "Specialized when value type is `string`, more efficient than the generic type,\nits compare behavior is fixed using the built-in comparison" |
| 3689 | + "Specialized when value type is `string`, more efficient than the generic type,\nits compare behavior is fixed using the built-in comparison", |
| 3690 | + "This module is [`Belt.Set`]() specialized with value type to be a primitive type.\nIt is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.Set`]()" |
3683 | 3691 | ],
|
3684 | 3692 | "items": [
|
3685 | 3693 | {
|
|
4007 | 4015 | "id": "Belt.Set.Int",
|
4008 | 4016 | "name": "Int",
|
4009 | 4017 | "docstrings": [
|
4010 |
| - "Specialized when value type is `int`, more efficient than the generic type, its\ncompare behavior is fixed using the built-in comparison" |
| 4018 | + "Specialized when value type is `int`, more efficient than the generic type, its\ncompare behavior is fixed using the built-in comparison", |
| 4019 | + "This module is [`Belt.Set`]() specialized with value type to be a primitive type.\nIt is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.Set`]()" |
4011 | 4020 | ],
|
4012 | 4021 | "items": [
|
4013 | 4022 | {
|
|
4335 | 4344 | "id": "Belt.SortArray.String",
|
4336 | 4345 | "name": "String",
|
4337 | 4346 | "docstrings": [
|
4338 |
| - "Specalized when key type is `string`, more efficient than the generic type" |
| 4347 | + "Specalized when key type is `string`, more efficient than the generic type", |
| 4348 | + "This is a specialized module for [`Belt_SortArray`](), the docs in that module also\napplies here, except the comparator is fixed and inlined" |
4339 | 4349 | ],
|
4340 | 4350 | "items": [
|
4341 | 4351 | {
|
|
4419 | 4429 | "id": "Belt.SortArray.Int",
|
4420 | 4430 | "name": "Int",
|
4421 | 4431 | "docstrings": [
|
4422 |
| - "Specalized when key type is `int`, more efficient than the generic type" |
| 4432 | + "Specalized when key type is `int`, more efficient than the generic type", |
| 4433 | + "This is a specialized module for [`Belt_SortArray`](), the docs in that module also\napplies here, except the comparator is fixed and inlined" |
4423 | 4434 | ],
|
4424 | 4435 | "items": [
|
4425 | 4436 | {
|
|
4629 | 4640 | "id": "Belt.Float",
|
4630 | 4641 | "name": "Float",
|
4631 | 4642 | "docstrings": [
|
4632 |
| - "[`Belt.Float`]()\n\n Utilities for Float." |
| 4643 | + "[`Belt.Float`]()\n\n Utilities for Float.", |
| 4644 | + "This module includes convenience methods for handling `float` types." |
4633 | 4645 | ],
|
4634 | 4646 | "items": [
|
4635 | 4647 | {
|
|
4710 | 4722 | "id": "Belt.Int",
|
4711 | 4723 | "name": "Int",
|
4712 | 4724 | "docstrings": [
|
4713 |
| - "[`Belt.Int`]()\n\n Utilities for Int." |
| 4725 | + "[`Belt.Int`]()\n\n Utilities for Int.", |
| 4726 | + "This module includes convenience methods for handling `int` types." |
4714 | 4727 | ],
|
4715 | 4728 | "items": [
|
4716 | 4729 | {
|
|
4791 | 4804 | "id": "Belt.Result",
|
4792 | 4805 | "name": "Result",
|
4793 | 4806 | "docstrings": [
|
4794 |
| - "[`Belt.Result`]()\n\n Utilities for result data type." |
| 4807 | + "[`Belt.Result`]()\n\n Utilities for result data type.", |
| 4808 | + "Result types are really useful to describe the result of a certain operation\nwithout relying on exceptions or `option` types.\n\nThis module gives you useful utilities to create and combine `Result` data." |
4795 | 4809 | ],
|
4796 | 4810 | "items": [
|
4797 | 4811 | {
|
|
4923 | 4937 | "id": "Belt.Option",
|
4924 | 4938 | "name": "Option",
|
4925 | 4939 | "docstrings": [
|
4926 |
| - "[`Belt.Option`]()\n\n Utilities for option data type." |
| 4940 | + "[`Belt.Option`]()\n\n Utilities for option data type.", |
| 4941 | + "In Belt we represent the existence and nonexistence of a value by wrapping it\nwith the `option` type. In order to make it a bit more convenient to work with\noption-types, Belt provides utility-functions for it.\n\nThe `option` type is a part of the ReScript standard library which is defined like this:\n\n## Examples\n\n```rescript\ntype option<'a> = None | Some('a)\n```\n\n```rescript\nlet someString: option<string> = Some(\"hello\")\n```" |
4927 | 4942 | ],
|
4928 | 4943 | "items": [
|
4929 | 4944 | {
|
|
5112 | 5127 | "id": "Belt.HashMap",
|
5113 | 5128 | "name": "HashMap",
|
5114 | 5129 | "docstrings": [
|
5115 |
| - "[`Belt.HashMap`]()\n\n The top level provides generic **mutable** hash map operations.\n\n It also has two specialized inner modules\n [`Belt.HashMap.Int`]() and [`Belt.HashMap.String`]()" |
| 5130 | + "[`Belt.HashMap`]()\n\n The top level provides generic **mutable** hash map operations.\n\n It also has two specialized inner modules\n [`Belt.HashMap.Int`]() and [`Belt.HashMap.String`]()", |
| 5131 | + "A **mutable** Hash map which allows customized [`hash`]() behavior.\n\nAll data are parameterized by not its only type but also a unique identity in\nthe time of initialization, so that two _HashMaps of ints_ initialized with different\n_hash_ functions will have different type.\n\n## Examples\n\n```rescript\ntype t = int\nmodule I0 = unpack(Belt.Id.hashableU(~hash=(. a: t) => \"&\"(a, 0xff_ff), ~eq=(. a, b) => a == b))\nlet s0: t<_, string, _> = make(~hintSize=40, ~id=module(I0))\n\nmodule I1 = unpack(Belt.Id.hashableU(~hash=(. a: t) => \"&\"(a, 0xff), ~eq=(. a, b) => a == b))\nlet s1: t<_, string, _> = make(~hintSize=40, ~id=module(I1))\n```\n\nThe invariant must be held: for two elements who are _equal_,\ntheir hashed value should be the same\n\nHere the compiler would infer `s0` and `s1` having different type so that\nit would not mix.\n\n## Examples\n\n```rescript\nlet s0: t<int, I0.identity>\nlet s1: t<int, I1.identity>\n```\n\nWe can add elements to the collection:\n\n## Examples\n\n```rescript\nlet () = {\n add(s1, 0, \"3\")\n add(s1, 1, \"3\")\n}\n```\n\nSince this is an mutable data strucure, `s1` will contain two pairs." |
5116 | 5132 | ],
|
5117 | 5133 | "items": [
|
5118 | 5134 | {
|
|
5335 | 5351 | "id": "Belt.HashSet",
|
5336 | 5352 | "name": "HashSet",
|
5337 | 5353 | "docstrings": [
|
5338 |
| - "[`Belt.HashSet`]()\n\n The top level provides generic **mutable** hash set operations.\n\n It also has two specialized inner modules\n [`Belt.HashSet.Int`]() and [`Belt.HashSet.String`]()" |
| 5354 | + "[`Belt.HashSet`]()\n\n The top level provides generic **mutable** hash set operations.\n\n It also has two specialized inner modules\n [`Belt.HashSet.Int`]() and [`Belt.HashSet.String`]()", |
| 5355 | + "A **mutable** Hash set which allows customized `hash` behavior.\n\nAll data are parameterized by not its only type but also a unique identity in\nthe time of initialization, so that two _HashSets of ints_ initialized with\ndifferent _hash_ functions will have different type.\n\n## Examples\n\n```rescript\nmodule I0 = unpack(\n Belt.Id.hashableU(\n ~hash=(. a: int) => land(a, 65535),\n ~eq=(. a, b) => a == b,\n )\n)\n\nlet s0 = Belt.HashSet.make(~id=module(I0), ~hintSize=40)\n\nmodule I1 = unpack(\n Belt.Id.hashableU(\n ~hash=(. a: int) => land(a, 255),\n ~eq=(. a, b) => a == b,\n )\n)\n\nlet s1 = Belt.HashSet.make(~id=module(I1), ~hintSize=40)\n\nBelt.HashSet.add(s1, 0)\nBelt.HashSet.add(s1, 1)\n```\n\nThe invariant must be held: for two elements who are equal, their hashed\nvalue should be the same.\n\nHere the compiler would infer `s0` and `s1` having different type so that it\nwould not mix.\n\n## Examples\n\n```rescript\nlet s0: Belt.HashSet.t<int, I0.identity>\nlet s1: Belt.HashSet.t<int, I1.identity>\n```\n\nWe can add elements to the collection (see last two lines in the example\nabove). Since this is an mutable data structure, `s1` will contain two pairs." |
5339 | 5356 | ],
|
5340 | 5357 | "items": [
|
5341 | 5358 | {
|
|
5843 | 5860 | "id": "Belt.MutableSet",
|
5844 | 5861 | "name": "MutableSet",
|
5845 | 5862 | "docstrings": [
|
5846 |
| - "[`Belt.MutableSet`]()\n\n The top level provides generic **mutable** set operations.\n\n It also has two specialized inner modules\n [`Belt.MutableSet.Int`]() and [`Belt.MutableSet.String`]()" |
| 5863 | + "[`Belt.MutableSet`]()\n\n The top level provides generic **mutable** set operations.\n\n It also has two specialized inner modules\n [`Belt.MutableSet.Int`]() and [`Belt.MutableSet.String`]()", |
| 5864 | + "A **mutable** sorted set module which allows customized compare behavior.\nThe implementation uses balanced binary trees, and therefore searching and insertion take time logarithmic in the size of the map.\n\nIt also has two specialized inner modules [Belt.MutableSet.Int](mutable-set-int) and [Belt.MutableSet.String](mutable-set-string) - This module separates data from function which is more verbose but slightly more efficient\n\n## Examples\n\n```rescript\nmodule PairComparator = 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 mySet = Belt.MutableSet.make(~id=module(PairComparator))\nmySet->Belt.MutableSet.add((1, 2))\n```" |
5847 | 5865 | ],
|
5848 | 5866 | "items": [
|
5849 | 5867 | {
|
|
6234 | 6252 | "id": "Belt.Map",
|
6235 | 6253 | "name": "Map",
|
6236 | 6254 | "docstrings": [
|
6237 |
| - "[`Belt.Map`](),\n\n The top level provides generic **immutable** map operations.\n\n It also has three specialized inner modules\n [`Belt.Map.Int`](), [`Belt.Map.String`]() and\n\n [`Belt.Map.Dict`](): This module separates data from function\n which is more verbose but slightly more efficient" |
| 6255 | + "[`Belt.Map`](),\n\n The top level provides generic **immutable** map operations.\n\n It also has three specialized inner modules\n [`Belt.Map.Int`](), [`Belt.Map.String`]() and\n\n [`Belt.Map.Dict`](): This module separates data from function\n which is more verbose but slightly more efficient", |
| 6256 | + "The top level provides generic immutable map operations.\n\nIt also has three specialized inner modules `Belt.Map.Int`, `Belt.Map.String`\nand `Belt.Map.Dict`." |
6238 | 6257 | ],
|
6239 | 6258 | "items": [
|
6240 | 6259 | {
|
|
6739 | 6758 | "id": "Belt.Set",
|
6740 | 6759 | "name": "Set",
|
6741 | 6760 | "docstrings": [
|
6742 |
| - "[`Belt.Set`]()\n\n The top level provides generic **immutable** set operations.\n\n It also has three specialized inner modules\n [`Belt.Set.Int`](), [`Belt.Set.String`]() and\n\n [`Belt.Set.Dict`](): This module separates data from function\n which is more verbose but slightly more efficient" |
| 6761 | + "[`Belt.Set`]()\n\n The top level provides generic **immutable** set operations.\n\n It also has three specialized inner modules\n [`Belt.Set.Int`](), [`Belt.Set.String`]() and\n\n [`Belt.Set.Dict`](): This module separates data from function\n which is more verbose but slightly more efficient", |
| 6762 | + "An _immutable_ sorted set module which allows customized _compare_ behavior.\n\nThe implementation uses balanced binary trees, and therefore searching\nand insertion take time logarithmic in the size of the map.\n\nFor more info on this module's usage of identity, `make` and others, please see\nthe top level documentation of Belt, **A special encoding for collection safety**.\n\n## Examples\n\n```rescript\nmodule PairComparator =\n 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 mySet = Belt.Set.make(~id=module(PairComparator))\nlet mySet2 = Belt.Set.add(mySet, (1, 2))\n```\n\n**Note:** This module's examples will assume a predeclared module for integers\ncalled `IntCmp`. It is declared like this:\n\n```rescript\nmodule IntCmp =\n Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n })\n```" |
6743 | 6763 | ],
|
6744 | 6764 | "items": [
|
6745 | 6765 | {
|
|
7134 | 7154 | "id": "Belt.Range",
|
7135 | 7155 | "name": "Range",
|
7136 | 7156 | "docstrings": [
|
7137 |
| - "[`Belt.Range`]()\n\n Utilities for a closed range `(from, start)`" |
| 7157 | + "[`Belt.Range`]()\n\n Utilities for a closed range `(from, start)`", |
| 7158 | + "A small utility module to provide inclusive range operations for `[start, finish]`.\nInternally it is relying on loops instead of creating new arrays, which makes it\npretty performant and memory friendly." |
7138 | 7159 | ],
|
7139 | 7160 | "items": [
|
7140 | 7161 | {
|
|
7223 | 7244 | "id": "Belt.List",
|
7224 | 7245 | "name": "List",
|
7225 | 7246 | "docstrings": [
|
7226 |
| - "[`Belt.List`]()\n\n Utilities for List data type" |
| 7247 | + "[`Belt.List`]()\n\n Utilities for List data type", |
| 7248 | + "Collection functions for manipulating the `list` data structures, a singly-linked list.\n\n**Prefer Array** if you need any of the following:\n\n- Random access of element\n- Better interop with JavaScript\n- Better memory usage & performance." |
7227 | 7249 | ],
|
7228 | 7250 | "items": [
|
7229 | 7251 | {
|
|
8035 | 8057 | "id": "Belt.MutableStack",
|
8036 | 8058 | "name": "MutableStack",
|
8037 | 8059 | "docstrings": [
|
8038 |
| - "[`Belt.MutableStack`]()\n\n An FILO(first in last out) stack data structure" |
| 8060 | + "[`Belt.MutableStack`]()\n\n An FILO(first in last out) stack data structure", |
| 8061 | + "First in last out stack. This module implements stacks, with in-place\nmodification." |
8039 | 8062 | ],
|
8040 | 8063 | "items": [
|
8041 | 8064 | {
|
|
8157 | 8180 | "id": "Belt.MutableQueue",
|
8158 | 8181 | "name": "MutableQueue",
|
8159 | 8182 | "docstrings": [
|
8160 |
| - "[`Belt.MutableQueue`]()\n\n An FIFO(first in first out) queue data structure" |
| 8183 | + "[`Belt.MutableQueue`]()\n\n An FIFO(first in first out) queue data structure", |
| 8184 | + "A FIFO (first in first out) queue data structure." |
8161 | 8185 | ],
|
8162 | 8186 | "items": [
|
8163 | 8187 | {
|
|
8356 | 8380 | "id": "Belt.SortArray",
|
8357 | 8381 | "name": "SortArray",
|
8358 | 8382 | "docstrings": [
|
8359 |
| - "[`Belt.SortArray`]()\n\n The top level provides some generic sort related utilities.\n\n It also has two specialized inner modules\n [`Belt.SortArray.Int`]() and [`Belt.SortArray.String`]()" |
| 8383 | + "[`Belt.SortArray`]()\n\n The top level provides some generic sort related utilities.\n\n It also has two specialized inner modules\n [`Belt.SortArray.Int`]() and [`Belt.SortArray.String`]()", |
| 8384 | + "A module for Array sort relevant utiliites" |
8360 | 8385 | ],
|
8361 | 8386 | "items": [
|
8362 | 8387 | {
|
|
8489 | 8514 | "id": "Belt.Array",
|
8490 | 8515 | "name": "Array",
|
8491 | 8516 | "docstrings": [
|
8492 |
| - "[`Belt.Array`]()\n\n **mutable array**: Utilities functions" |
| 8517 | + "[`Belt.Array`]()\n\n **mutable array**: Utilities functions", |
| 8518 | + "Utililites for `Array` functions.\n\n### Note about index syntax\n\nCode like `arr[0]` does *not* compile to JavaScript `arr[0]`. Reason transforms\nthe `[]` index syntax into a function: `Array.get(arr, 0)`. By default, this\nuses the default standard library's `Array.get` function, which may raise an\nexception if the index isn't found. If you `open Belt`, it will use the\n`Belt.Array.get` function which returns options instead of raising exceptions. \n[See this for more information](../belt.mdx#array-access-runtime-safety)." |
8493 | 8519 | ],
|
8494 | 8520 | "items": [
|
8495 | 8521 | {
|
|
9187 | 9213 | "id": "Belt.Id",
|
9188 | 9214 | "name": "Id",
|
9189 | 9215 | "docstrings": [
|
9190 |
| - "[`Belt.Id`]()\n\n Provide utilities to create identified comparators or hashes for\n data structures used below.\n\n It create a unique identifier per module of\n functions so that different data structures with slightly different\n comparison functions won't mix" |
| 9216 | + "[`Belt.Id`]()\n\n Provide utilities to create identified comparators or hashes for\n data structures used below.\n\n It create a unique identifier per module of\n functions so that different data structures with slightly different\n comparison functions won't mix", |
| 9217 | + "[`Belt.Id`]()\n\nProvide utiliites to create identified comparators or hashes for\ndata structures used below.\n\nIt create a unique identifer per module of functions so that different data structures with slightly different\ncomparison functions won't mix." |
9191 | 9218 | ],
|
9192 | 9219 | "items": [
|
9193 | 9220 | {
|
|
0 commit comments