https://github.com/sam9111/rescript-tutorial
https://github.com/sam9111/rescript-tutorial
rescript webdevelopment-301
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sam9111/rescript-tutorial
- Owner: sam9111
- License: cc-by-sa-4.0
- Created: 2021-02-13T10:59:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-30T05:50:41.000Z (over 4 years ago)
- Last Synced: 2025-07-26T01:38:46.923Z (11 months ago)
- Topics: rescript, webdevelopment-301
- Language: ReScript
- Homepage:
- Size: 235 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
> Learnings from the "Web Development 301 - Typed Functional Programming" course as part of the Coronasafe Engineering Fellowship 2021
[](./LICENSE.md)
# Getting started
```
git clone https://github.com/protoship/rescript-tutorial.git
cd rescript-tutorial
npm install
npm run start
```
Then open VSCode in the same directory:
```
code .
```
Install the [rescript-vscode plugin](https://marketplace.visualstudio.com/items?itemName=chenglou92.rescript-vscode). For this, press ctrl+shift+p (cmd+shift+p in Mac) -> "Install Extensions" -> "rescript-vscode".
Now you're all set to begin the tutorial!
Open the first chapter - `chap_1_immutable.res` and follow the instructions in the file.
As you're editing the code, watch the terminal where you ran `npm run start`. It will show any errors from the ReScript compiler and you will have to refer to it often as you're working through the exercises.
The ReScript compiler compiles the `.res` files gets into `.bs.js` files. For the first chapter, that would be `chap_1_immutable.bs.js`. You should open that file as well in a new window by pressing CTRL+O (CMD+O in Mac) and selecting the correct `.bs.js` file. Keep both `.res` file and `.bs.js` file side-by-side so you can see how the ReScript you write gets compiled to JavaScript in real-time.
**Important Note**: You can run the ReScript program by calling `node` on the generated `.bs.js` file:
```
node src/chap_1_immutable.bs.js
```
There are automated tests scattered throughout the exercises - you can see their results by running the generated JavaScript. You can also add `Js.log` in your ReScript code to print any intermediate values for debugging.