You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,10 @@
21
21
22
22
- GenType: now emits full suffix on JS import path to be compatible with `.res.js`. https://github.com/rescript-lang/rescript-compiler/pull/6541
23
23
24
+
#### :nail_care: Polish
25
+
26
+
- Format docstrings. https://github.com/rescript-lang/rescript-compiler/pull/6417
@@ -104,16 +114,18 @@ For collections types like set or map, Belt provides both a generic module as we
104
114
For example, Belt has the following set modules:
105
115
106
116
- [Belt.Set](belt/set)
107
-
- [Belt.Set.Int](belt/set-int)
108
-
- [Belt.Set.String](belt/set-string)
117
+
- [Belt.Set.Int](belt/set/int)
118
+
- [Belt.Set.String](belt/set/string)
109
119
110
120
## Implementation Details
111
121
112
122
### Array access runtime safety
113
123
114
124
One common confusion comes from the way Belt handles array access. It differs from than the default standard library's.
115
125
116
-
```
126
+
## Examples
127
+
128
+
```rescript
117
129
let letters = ["a", "b", "c"]
118
130
let a = letters[0] // a == "a"
119
131
let capitalA = Js.String.toUpperCase(a)
@@ -122,7 +134,9 @@ let k = letters[10] // Raises an exception! The 10th index doesn't exist.
122
134
123
135
Because Belt avoids exceptions and returns `options` instead, this code behaves differently:
124
136
125
-
```
137
+
## Examples
138
+
139
+
```rescript
126
140
open Belt
127
141
let letters = ["a", "b", "c"]
128
142
let a = letters[0] // a == Some("a")
@@ -138,7 +152,9 @@ Although we've fixed the problem where `k` raises an exception, we now have a ty
138
152
139
153
Fortunately, this is easy to fix:
140
154
141
-
```res example
155
+
## Examples
156
+
157
+
```rescript
142
158
open Belt
143
159
let letters = ["a", "b", "c"]
144
160
let a = letters[0]
@@ -161,7 +177,9 @@ When we create a collection library for a custom data type we need a way to prov
161
177
162
178
We use a phantom type to solve the problem:
163
179
164
-
```
180
+
## Examples
181
+
182
+
```rescript
165
183
module Comparable1 =
166
184
Belt.Id.MakeComparable(
167
185
{
@@ -193,7 +211,9 @@ let mySet2 = Belt.Set.make(~id=module(Comparable2))
193
211
194
212
Here, 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.
0 commit comments