Skip to content

Commit 2fd0b80

Browse files
committed
links to api/core changed to api/stdlib
1 parent 9041cbd commit 2fd0b80

14 files changed

+27
-66
lines changed

markdown-pages/blogposts/2024-01-11-release-11-0-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ This release is also introducing uncurried mode, which is a new default mode tha
5252

5353
[ReScript Core](https://github.com/rescript-lang/rescript-core) is ReScript's new standard library. It replaces the complete `Js` module as well as some of the more frequently used modules from `Belt` and is recommended to use with uncurried mode.
5454

55-
The latest docs on [rescript-lang.org](/) already use it for the examples. Have a look at the new [RescriptCore API docs](/docs/manual/api/core).
55+
The latest docs on [rescript-lang.org](/) already use it for the examples. Have a look at the new [RescriptCore API docs](/docs/manual/api/stdlib).
5656

5757
## More Features
5858

markdown-pages/docs/manual/array-and-list.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ var tenthItem = myArray[10];
5252

5353
</CodeTab>
5454

55-
The behavior of returning an `option` is new to V11 when you have [Core](api/core) open.
55+
The behavior of returning an `option` is new to V11 when you have [Core](api/stdlib) open.
5656
It provides a safer way to access array items, which is especially useful when you're not sure if the index is out of bounds.
57-
If you would like to not use an `option`, you can use [`Array.getUnsafe`](api/core/array#value-getUnsafe).
57+
If you would like to not use an `option`, you can use [`Array.getUnsafe`](api/stdlib/array#value-getUnsafe).
5858

5959
#### Update
6060

@@ -153,7 +153,7 @@ You'd use list for its resizability, its fast prepend (adding at the head), and
153153

154154
Do **not** use list if you need to randomly access an item or insert at non-head position. Your code would end up obtuse and/or slow.
155155

156-
The standard lib provides a [List module](api/core/list).
156+
The standard lib provides a [List module](api/stdlib/list).
157157

158158
#### Immutable Prepend
159159

markdown-pages/docs/manual/bind-to-global-js-values.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ order: 8
88

99
# Bind to Global JS Values
1010

11-
**First**, make sure the value you'd like to model doesn't already exist in our [provided API](api/core).
11+
**First**, make sure the value you'd like to model doesn't already exist in our [provided API](api/stdlib).
1212

1313
Some JS values, like `setTimeout`, live in the global scope. You can bind to them like so:
1414

@@ -25,7 +25,7 @@ Some JS values, like `setTimeout`, live in the global scope. You can bind to the
2525

2626
</CodeTab>
2727

28-
(We already provide `setTimeout`, `clearTimeout` and others in the [Core API](api/core) module).
28+
(We already provide `setTimeout`, `clearTimeout` and others in the [Core API](api/stdlib) module).
2929

3030
This binds to the JavaScript [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrworkerGlobalScope/setTimeout) methods and the corresponding `clearTimeout`. The `external`'s type annotation specifies that `setTimeout`:
3131

markdown-pages/docs/manual/bind-to-js-object.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ If your JavaScript object:
164164
- might or might not add/remove keys
165165
- contains only values that are of the same type
166166

167-
Then it's not really an object, it's a hash map. Use [Dict](api/core/dict), which contains operations like `get`, `set`, etc. and cleanly compiles to a JavaScript object still.
167+
Then it's not really an object, it's a hash map. Use [Dict](api/stdlib/dict), which contains operations like `get`, `set`, etc. and cleanly compiles to a JavaScript object still.
168168

169169
## Bind to a JS Object That's a Class
170170

markdown-pages/docs/manual/exception.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ order: 19
88

99
# Exception
1010

11-
Exceptions are just a special kind of variant, thrown in **exceptional** cases (don't abuse them!). Consider using the [`option`](null-undefined-option) or [`result`](api/core/result) type for recoverable errors.
11+
Exceptions are just a special kind of variant, thrown in **exceptional** cases (don't abuse them!). Consider using the [`option`](null-undefined-option) or [`result`](api/stdlib/result) type for recoverable errors.
1212

1313
You can create your own exceptions like you'd make a variant (exceptions need to be capitalized too).
1414

@@ -381,8 +381,8 @@ try {
381381
}
382382
```
383383

384-
The payload `exn` here is of type `unknown` since in JS you can throw anything. To operate on `exn`, do like the code above by using the standard library's [`JsExn`](api/core/jsexn) module's helpers
385-
or use [`Type.Classify.classify`](api/core/type/classify#value-classify) to get more information about the runtime type of `exn`.
384+
The payload `exn` here is of type `unknown` since in JS you can throw anything. To operate on `exn`, do like the code above by using the standard library's [`JsExn`](api/stdlib/jsexn) module's helpers
385+
or use [`Type.Classify.classify`](api/stdlib/type/classify#value-classify) to get more information about the runtime type of `exn`.
386386

387387
## Throw a JS Exception
388388

markdown-pages/docs/manual/json.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Where `data` can be any type you assume the JSON is. As you can see, this compil
3737

3838
## Stringify
3939

40-
Use [`JSON.stringify`](api/core/json#value-stringify) if your data is of type `JSON.t` or [`JSON.stringifyAny`](api/core/json#value-stringifyAny) if it is not.
40+
Use [`JSON.stringify`](api/stdlib/json#value-stringify) if your data is of type `JSON.t` or [`JSON.stringifyAny`](api/stdlib/json#value-stringifyAny) if it is not.
4141

4242
<CodeTab labels={["ReScript", "JS Output"]}>
4343

markdown-pages/docs/manual/libraries.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ Search `rescript`-related packages on NPM, or use our [Package Index](/packages)
2525
If you can't find what you're looking for, remember that **you don't need a wrapper** to use a JS library:
2626

2727
- Most JS data types, such as array and objects, [map over cleanly to ReScript and vice-versa](shared-data-types).
28-
- You also have access to the familiar [Core API](api/core).
28+
- You also have access to the familiar [Core API](api/stdlib).
2929
- You can use a JavaScript library without needing to install dedicated binding libraries. Check the [`external`](external) page.

markdown-pages/docs/manual/migrate-to-v11.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ One major change to be aware of is that array access now returns an `option`.
6868
let firstItem = myArray[0] // Some("hello")
6969
```
7070

71-
If you would like to not use an `option`, you can use [`Array.getUnsafe`](api/core/array#value-getUnsafe).
71+
If you would like to not use an `option`, you can use [`Array.getUnsafe`](api/stdlib/array#value-getUnsafe).
7272

7373
For a detailed explanation on migration to ReScript Core, please refer to its [migration guide](https://github.com/rescript-association/rescript-core#migration). A semi-automated script is available as well.
7474

75-
See ReScript Core API docs [here](api/core).
75+
See ReScript Core API docs [here](api/stdlib).
7676

7777
### Removed bindings
7878

markdown-pages/docs/manual/null-undefined-option.mdx

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -126,50 +126,11 @@ compiles to `undefined`! If you've got e.g. a string in JavaScript that you know
126126

127127
### Caveat 1
128128

129-
The option-to-undefined translation isn't perfect, because on our side, `option` values can be composed:
130-
131-
<CodeTab labels={["ReScript", "JS Output"]}>
132-
133-
```res example
134-
let x = Some(Some(Some(5)))
135-
```
136-
137-
```js
138-
var x = 5;
139-
```
140-
141-
</CodeTab>
142-
143-
This still compiles to `5`, but this gets troublesome:
144-
145-
<CodeTab labels={["ReScript", "JS Output"]}>
146-
147-
```res example
148-
let x = Some(None)
149-
```
150-
151-
```js
152-
var Caml_option = require("./stdlib/caml_option.js");
153-
154-
var x = Caml_option.some(undefined);
155-
```
156-
157-
(See output tab).
158-
159-
</CodeTab>
160-
161-
What's this `Caml_option.some` thing? Why can't this compile to `undefined`? Long story short, when dealing with a polymorphic `option` type (aka `option<'a>`, for any `'a`), many operations become tricky if we don't mark the value with some special annotation. If this doesn't make sense, don't worry; just remember the following rule:
162-
163-
- **Never, EVER, pass a nested `option` value (e.g. `Some(Some(Some(5)))`) into the JS side.**
164-
- **Never, EVER, annotate a value coming from JS as `option<'a>`. Always give the concrete, non-polymorphic type.**
165-
166-
### Caveat 2
167-
168129
Unfortunately, lots of times, your JavaScript value might be _both_ `null` or `undefined`. In that case, you unfortunately can't type such value as e.g. `option<int>`, since our `option` type only checks for `undefined` and not `null` when dealing with a `None`.
169130

170131
#### Solution: More Sophisticated `undefined` & `null` Interop
171132

172-
To solve this, we provide access to more elaborate `null` and `undefined` helpers through the [`Nullable`](api/core/nullable) module. This somewhat works like an `option` type, but is different from it.
133+
To solve this, we provide access to more elaborate `null` and `undefined` helpers through the [`Nullable`](api/stdlib/nullable) module. This somewhat works like an `option` type, but is different from it.
173134

174135
#### Examples
175136

markdown-pages/docs/manual/primitive-types.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This is just like JavaScript's backtick string interpolation, except without nee
7777

7878
### Usage
7979

80-
See the familiar `String` API in the [API docs](api/core/string). Since a ReScript string maps to a JavaScript string, you can mix & match the string operations in all standard libraries.
80+
See the familiar `String` API in the [API docs](api/stdlib/string). Since a ReScript string maps to a JavaScript string, you can mix & match the string operations in all standard libraries.
8181

8282
### Tips & Tricks
8383

@@ -127,7 +127,7 @@ let r = /b/g;
127127

128128
</CodeTab>
129129

130-
A regular expression like the above has the type `RegExp.t`. The [RegExp](api/core/regexp) module contains the regular expression helpers you have seen in JS.
130+
A regular expression like the above has the type `RegExp.t`. The [RegExp](api/stdlib/regexp) module contains the regular expression helpers you have seen in JS.
131131

132132
## Boolean
133133

@@ -146,15 +146,15 @@ ReScript's `true/false` compiles into a JavaScript `true/false`.
146146

147147
## Integers
148148

149-
32-bits, truncated when necessary. We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [Int](api/core/int) for helper functions.
149+
32-bits, truncated when necessary. We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [Int](api/stdlib/int) for helper functions.
150150

151151
**Be careful when you bind to JavaScript numbers!** Since ReScript integers have a much smaller range than JavaScript numbers, data might get lost when dealing with large numbers. In those cases it’s much safer to bind the numbers as **float**. Be extra mindful of this when binding to JavaScript Dates and their epoch time.
152152

153153
To improve readability, you may place underscores in the middle of numeric literals such as `1_000_000`. Note that underscores can be placed anywhere within a number, not just every three digits.
154154

155155
## Floats
156156

157-
Float requires other operators: `+.`, `-.`, `*.`, `/.`, etc. Like `0.5 +. 0.6`. See [Float](api/core/float) for helper functions.
157+
Float requires other operators: `+.`, `-.`, `*.`, `/.`, etc. Like `0.5 +. 0.6`. See [Float](api/stdlib/float) for helper functions.
158158

159159
As with integers, you may use underscores within literals to improve readability.
160160

@@ -179,7 +179,7 @@ var result = 1 + 2;
179179
**Since 11.1**
180180

181181
For values which are too large to be represented by Int or Float, there is the `bigint` primitive type.
182-
We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [BigInt](api/core/bigint) for helper functions.
182+
We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [BigInt](api/stdlib/bigint) for helper functions.
183183

184184
A `bigint` number is denoted by a trailing `n` like so: `42n`.
185185

0 commit comments

Comments
 (0)