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: pages/docs/manual/latest/polymorphic-variant.mdx
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -133,7 +133,7 @@ let other = [#GreeN]
133
133
let all = Belt.Array.concat(colors, other)
134
134
```
135
135
136
-
I'd get an error on the `concat` call, even thought he error actually stems from my typo in my `other` definition.
136
+
I'd get an error on the `concat` call, even thought the error was actually caused by the typo in the value assignment of `other`.
137
137
138
138
## JavaScript Output
139
139
@@ -215,7 +215,7 @@ Since we were using poly variants, the JS Output is practically zero-cost and do
215
215
216
216
## Lower / Upper Bound Constraints
217
217
218
-
There are a few different ways to define constraints on a poly variant type, such as `[>`, `[<` and `[]`. Some of them were briefly mentioned before, so in this section we will quickly explain what this syntax is about.
218
+
There are a few different ways to define constraints on a poly variant type, such as `[>`, `[<` and `[`. Some of them were briefly mentioned before, so in this section we will quickly explain what this syntax is about.
219
219
220
220
**Note:** We added this info for educational purposes. In most cases you will not want to use any of this stuff, since it makes your APIs pretty unreadable / hard to use.
221
221
@@ -237,7 +237,7 @@ In case you want to define a type that is extensible in polymorphic ways (or in
237
237
238
238
A lower bound defines the minimum set of constructors a poly variant type is aware of. It is also considered an "open poly variant type", because it doesn't restrict any additional values.
239
239
240
-
Here is an example on how to make a minimum set of `basicBlueTones` extensible in a new `colors` type:
240
+
Here is an example on how to make a minimum set of `basicBlueTones` extensible for a new `colors` type:
241
241
242
242
```res
243
243
type basicBlueTone<'a> = [> #Blue | #DeepBlue | #Azuro ] as 'a
@@ -254,9 +254,9 @@ Here, the compiler will enforce the user to define `#Blue | #DeepBlue | #Azuro`
254
254
255
255
### Upper Bound (`[<`)
256
256
257
-
The upper bound works in the exact opposite way: The extending type may only use constructors that are stated in the lower bound constraing.
257
+
The upper bound works in the exact opposite way: The extending type may only use constructors that are stated in the lower bound constraint.
258
258
259
-
Same example:
259
+
Here another example, but with red colors:
260
260
261
261
```res
262
262
type validRed<'a> = [< #Fire | #Crimson | #Ash] as 'a
0 commit comments