Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions docs/ABOUT.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth mentioning the React side of things here since there is no use of it in this track?

https://rescript-lang.org/ has some phrases we can steal from the homepage.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I updated the ABOUT.md to put the JavaScript ecosystem front, weave in the type safety, and then bring up React on the way out. Exercism exercises doesn't focus on frameworks, but we're pitching prospective students on the language, not the track itself. So referencing React is fair game and lets us position ReScript as an alternative to TypeScript. I figure prospective students are more than likely already curious about ReScript for web dev and not someone like me going in blind.

Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# About

<!-- TODO: write document
Write [ReScript][rescript-lang], ship JavaScript.
Built on OCaml's robust type system and the modern successor to BuckleScript and ReasonML, ReScript offers exhaustive pattern matching and compile-time guarantees within the JavaScript ecosystem.
Its first-class React integration makes it a compelling alternative to TypeScript for developers who want genuine type safety rather than annotated JavaScript.
No `any`, no surprise `undefined`.

This document contains a short introduction to the language.

The introduction should be relatively brief and touch upon what
makes the language interesting (and possibly unique). The goal
is to help students decide if they want to join this track.

The contents of this document are displayed on the track page,
provided the student has not joined the track.

See https://exercism.org/docs/building/tracks/docs for more information. -->
[rescript-lang]: https://rescript-lang.org
34 changes: 25 additions & 9 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
# Installation

<!-- TODO: write document
This track uses ReScript 12 and relies on [Node.js][nodejs] 22 or greater.
Many systems will have this pre-installed or you may have previously installed it for another track.

This document should describe what the student needs to install
to allow working on the track on their local system using the CLI.
Open a terminal and run:

You can include the installation instructions in this document, but
usually it is better to link to a resource with the official installation
instructions, to prevent the instructions from becoming outdated.
```sh
node -v
```

The contents of this document are displayed on the track's documentation
page at `https://exercism.org/docs/tracks/<track>/installation`.
If Node isn't installed or an older version is listed, please follow [the official Node.js installation][nodejs-install] instructions for your platform.

See https://exercism.org/docs/building/tracks/docs for more information. -->
## Installing dependencies

Each ReScript exercise is a self-contained npm project.
After downloading an exercise with the [Exercism CLI][exercism-cli], install the project dependencies including ReScript and you're ready to go:

```sh
cd /path/to/exercise
npm install
```

## Editor support

The ReScript Project maintains a [list of both official and community-supported editor plugins][rescript-plugins].

[nodejs]: https://nodejs.org/
[nodejs-install]: https://nodejs.org/en/download
[exercism-cli]: https://github.com/exercism/cli
[rescript-plugins]: https://rescript-lang.org/docs/manual/editor-plugins
22 changes: 15 additions & 7 deletions docs/LEARNING.md
Comment thread
BNAndras marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# Learning

<!-- TODO: write document
## ReScript Resources

This document should link to learning resources.
- [ReScript Language Manual][language-manual]
- [ReScript for JavaScript Developers][rescript-for-js]
- [ReScript Forums][rescript-forums]
- [ReScript Playground][rescript-playground]
- [ReScript Community Content][community-content]

Feel free to link to any good learning resources you know, whether they
be websites, blogs, books, videos or courses.
## Coming from other languages

The contents of this document are displayed on the track's documentation
page at `https://exercism.org/docs/tracks/<track>/learning`.
If you know **JavaScript or TypeScript**, ReScript's syntax will look familiar.

See https://exercism.org/docs/building/tracks/docs for more information. -->
If you know **OCaml**, ReScript shares the same type system and many of the same concepts.

[language-manual]: https://rescript-lang.org/docs/manual/introduction
[rescript-for-js]: https://rescript-lang.org/docs/manual/rescript-for-javascript-developers
[rescript-forums]: https://forum.rescript-lang.org
[rescript-playground]: https://rescript-lang.org/try
[community-content]: https://rescript-lang.org/community/content/
22 changes: 11 additions & 11 deletions docs/RESOURCES.md
Comment thread
BNAndras marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Resources

<!-- TODO: write document

This document should link to useful resources.

Feel free to link to any good resources you know, whether they
be websites, videos, mailing lists, etc.

The contents of this document are displayed on the track's documentation
page at `https://exercism.org/docs/tracks/<track>/resources`.

See https://exercism.org/docs/building/tracks/docs for more information. -->
- [ReScript Language Manual][language-manual]
- [Awesome ReScript][awesome-rescript]
- [ReScript Forums][rescript-forums]
- [ReScript Playground][rescript-playground]
- [ReScript Community Content][community-content]

[language-manual]: https://rescript-lang.org/docs/manual/introduction
[awesome-rescript]: https://github.com/rescript-lang/awesome-rescript
[rescript-forums]: https://forum.rescript-lang.org
[rescript-playground]: https://rescript-lang.org/try
[community-content]: https://rescript-lang.org/community/content/
9 changes: 8 additions & 1 deletion docs/SNIPPET.txt
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
TODO: add snippet
let rec fibonacci = n =>
switch n {
| 0 => 0
| 1 => 1
| n => fibonacci(n - 1) + fibonacci(n - 2)
}

let first10 = Array.fromInitializer(~length=10, fibonacci)
106 changes: 97 additions & 9 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,103 @@
# Tests
# Running the Tests

<!-- TODO: write document
## Download an Exercise

This document should describe everything related to running tests in the track.
Use the [Exercism CLI][cli] to download the exercise you want to work on.

If your track uses skipped tests, this document can explain why thet is used and
how to unskip tests.
```sh
exercism download --track=rescript --exercise=hello-world
```

This document can also link to the testing framework documentation.
Then change into the exercise directory.

The contents of this document are displayed on the track's documentation
page at `https://exercism.org/docs/tracks/<track>/tests`.
```sh
cd /path/to/exercism/rescript/hello-world
```

See https://exercism.org/docs/building/tracks/docs for more information. -->
## Install Dependencies

Before running the tests, install the exercise dependencies.

```sh
npm install
```

## Run the Tests

Compile and run the provided test suite using either `exercism test` or `npm install`.

## Understanding Test Results

The test runner shows each test run with a pass/fail status.

```text
1/3: no name given
PASS - no name given
2/3: a name given
FAIL - a name given
---
operator: equal
left: One for you, one for me.
right: One for Alice, one for me.
...
3/3: another name given
FAIL - another name given
---
operator: equal
left: One for you, one for me.
right: One for Bob, one for me.
...

# Ran 3 tests (3 assertions)
# 1 passed
# 2 failed
```

`left` is what your code returned. `right` is what the test expected.

## Understanding the Exercise Structure

```text
two-fer/
├── src/
│ ├── TwoFer.res // your solution goes here
│ └── TwoFer.resi // the optional interface file containing signatures
├── tests/
│ └── TwoFer_test.res // your test suite
├── package.json // used to install project dependencies
└── ...
```

`TwoFer.resi` here is an optional interface file.
When present, it defines the function signatures your solution must satisfy and can serve as a hint for what to implement.

For example, if the interface declares:

```rescript
let hello: unit => string
```

Your implementation should define:

```rescript
let hello = () => "Hello, World!"
```

## Compiler Errors

If your code doesn't compile, ReScript's compiler produces detailed error messages with the exact location and expected types.

```text
We've found a bug for you!

1 │ let x: string = 42

This has type: int
But it's expected to have type: string

You can convert int to string with Int.toString.
```

Read the error message carefully because it usually points directly to the problem.

[cli]: https://exercism.org/docs/using/solving-exercises/working-locally
24 changes: 7 additions & 17 deletions exercises/shared/.docs/help.md
Comment thread
BNAndras marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
# Help

<!-- TODO: write document
## Useful resources

This document should contain track-specific instructions on how to get help when
the student is stuck.
- [ReScript Language Manual][language-manual]
- [ReScript for JavaScript Developers][rescript-for-js]
- [ReScript Forums][rescript-forums]

The instructions should be short and to the point.

You could link to resources like Gitter channels, forums or mailing lists:
whatever can help a student become unstuck.

This document should **not** link to Exercism-wide (track-agnostic) help resources,
as those resources will automatically be included in the HELP.md file.

The links in this document can overlap with those in docs/LEARNING.md or docs/RESOURCES.md

When a student downloads an exercise via the CLI, this file's contents are
included into the HELP.md file.

See https://exercism.org/docs/building/tracks/shared-files for more information. -->
[language-manual]: https://rescript-lang.org/docs/manual/introduction
[rescript-for-js]: https://rescript-lang.org/docs/manual/rescript-for-javascript-developers
[rescript-forums]: https://forum.rescript-lang.org
15 changes: 2 additions & 13 deletions exercises/shared/.docs/tests.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
# Tests

<!-- TODO: write document

This document should contain instructions on how to run the exercise's tests.

The instructions should be short and to the point.

The docs/TESTS.md file can contain a more verbose description on how to run tests.

When a student downloads an exercise via the CLI, this file's contents are
included into the HELP.md file.

See https://exercism.org/docs/building/tracks/shared-files for more information.
-->
First, install dependencies if you haven't already by running `npm install` in the project folder.
Then, run the tests either using `exercism test` or `npm test`.