-
Notifications
You must be signed in to change notification settings - Fork 2
Add track docs #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add track docs #42
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,5 @@ | ||
| # About | ||
|
|
||
| <!-- TODO: write document | ||
|
|
||
| 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. --> | ||
| If it compiles, it runs. | ||
| ReScript is a typed language that brings OCaml's type system to the JavaScript ecosystem, with built-in JSX syntax and official React bindings. | ||
| Every type is inferred, there is no `any` escape hatch, and pattern matching is exhaustive. |
| 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 |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, I was looking at the 11.0.0 documentation. I'll condense the two links. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| # Learning | ||
|
|
||
| <!-- TODO: write document | ||
| ## Official documentation | ||
|
|
||
| This document should link to learning resources. | ||
| - [ReScript Language Manual](https://rescript-lang.org/docs/manual/latest/overview) — primary reference | ||
| - [ReScript API](https://rescript-lang.org/docs/manual/latest/api) — standard library reference | ||
| - [ReScript Playground](https://rescript-lang.org/try) — in-browser editor where you can write ReScript and see the compiled JavaScript output side by side. | ||
|
|
||
| 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. |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,5 @@ | ||
| # 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](https://rescript-lang.org/docs/manual/introduction) — full language reference | ||
| - [ReScript API](https://rescript-lang.org/docs/manual/latest/api) — standard library documentation | ||
| - [ReScript Forum](https://forum.rescript-lang.org/) — the official discussion forum |
| 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) |
| 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 |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,8 @@ | ||
| # Help | ||
|
|
||
| <!-- TODO: write document | ||
| ## Useful resources | ||
|
|
||
| This document should contain track-specific instructions on how to get help when | ||
| the student is stuck. | ||
|
|
||
| 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. --> | ||
| - [ReScript Language Manual](https://rescript-lang.org/docs/manual/introduction) — full language reference | ||
| - [ReScript API](https://rescript-lang.org/docs/manual/latest/api) — standard library documentation | ||
| - [ReScript Discord](https://rescript-lang.org/community#discord) - the official Discord server | ||
| - [ReScript Forum](https://forum.rescript-lang.org/) — the official discussion forum |
| 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`. |
There was a problem hiding this comment.
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.