-
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
Open
BNAndras
wants to merge
7
commits into
exercism:main
Choose a base branch
from
BNAndras:add-track-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add track docs #42
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0b67b21
add SNIPPET.txt
BNAndras c5dc1b4
Add track docs
BNAndras bfe209e
Update ABOUT.md
BNAndras d028124
Clean up LEARNING.md
BNAndras 8c85500
Update RESOURCES.md
BNAndras 8316c81
Update shared help.md
BNAndras ec0c23c
Remove stray empty line
BNAndras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
|
BNAndras marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
|
BNAndras marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
|
BNAndras marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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.