From 0b67b217cb91b034945d1c9458f4a48d005e86cf Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:17:16 -0700 Subject: [PATCH 1/7] add SNIPPET.txt --- docs/SNIPPET.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/SNIPPET.txt b/docs/SNIPPET.txt index 4b4a4f0..d9f4ceb 100644 --- a/docs/SNIPPET.txt +++ b/docs/SNIPPET.txt @@ -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) From c5dc1b4c9455f563fb621cc633b730bec827c63b Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Mon, 30 Mar 2026 22:45:52 -0700 Subject: [PATCH 2/7] Add track docs --- docs/ABOUT.md | 15 +---- docs/INSTALLATION.md | 34 +++++++--- docs/LEARNING.md | 14 ++--- docs/RESOURCES.md | 14 +---- docs/TESTS.md | 106 +++++++++++++++++++++++++++++--- exercises/shared/.docs/help.md | 23 ++----- exercises/shared/.docs/tests.md | 15 +---- 7 files changed, 142 insertions(+), 79 deletions(-) diff --git a/docs/ABOUT.md b/docs/ABOUT.md index 9864ed0..4c4b0df 100644 --- a/docs/ABOUT.md +++ b/docs/ABOUT.md @@ -1,14 +1,5 @@ # About - +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. diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index cd6ce85..1433248 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -1,15 +1,31 @@ # Installation - +## 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 diff --git a/docs/LEARNING.md b/docs/LEARNING.md index b14434d..1ff2d5b 100644 --- a/docs/LEARNING.md +++ b/docs/LEARNING.md @@ -1,13 +1,13 @@ # Learning - +If you know **OCaml**, ReScript shares the same type system and many of the same concepts. diff --git a/docs/RESOURCES.md b/docs/RESOURCES.md index 9811f04..74e109c 100644 --- a/docs/RESOURCES.md +++ b/docs/RESOURCES.md @@ -1,13 +1,5 @@ # Resources - +- [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 diff --git a/docs/TESTS.md b/docs/TESTS.md index bec9502..e5bcc69 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -1,15 +1,103 @@ -# Tests +# Running the Tests - +## 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 diff --git a/exercises/shared/.docs/help.md b/exercises/shared/.docs/help.md index 45aa2d6..7084ca8 100644 --- a/exercises/shared/.docs/help.md +++ b/exercises/shared/.docs/help.md @@ -1,21 +1,8 @@ # Help - +- [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 diff --git a/exercises/shared/.docs/tests.md b/exercises/shared/.docs/tests.md index 1f197bf..95d24c8 100644 --- a/exercises/shared/.docs/tests.md +++ b/exercises/shared/.docs/tests.md @@ -1,15 +1,4 @@ # Tests - +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`. From bfe209e6033006b9b583fc8decaf677bb60b0051 Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Tue, 2 Jun 2026 21:43:47 -0700 Subject: [PATCH 3/7] Update ABOUT.md --- docs/ABOUT.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/ABOUT.md b/docs/ABOUT.md index 4c4b0df..b670fd9 100644 --- a/docs/ABOUT.md +++ b/docs/ABOUT.md @@ -1,5 +1,9 @@ # About -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. +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`. + +[rescript-lang]: https://rescript-lang.org From d0281248bf91ad18a579bd2488e16e2ade352ece Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Tue, 2 Jun 2026 21:58:42 -0700 Subject: [PATCH 4/7] Clean up LEARNING.md --- docs/LEARNING.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/LEARNING.md b/docs/LEARNING.md index 1ff2d5b..00162b9 100644 --- a/docs/LEARNING.md +++ b/docs/LEARNING.md @@ -1,13 +1,21 @@ # Learning -## Official documentation +## ReScript 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. +- [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] ## Coming from other languages If you know **JavaScript or TypeScript**, ReScript's syntax will look familiar. 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/ From 8c85500f78ac0564004f32f5852e66ef0dfe8b11 Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Tue, 2 Jun 2026 22:01:21 -0700 Subject: [PATCH 5/7] Update RESOURCES.md --- docs/RESOURCES.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/RESOURCES.md b/docs/RESOURCES.md index 74e109c..691770e 100644 --- a/docs/RESOURCES.md +++ b/docs/RESOURCES.md @@ -1,5 +1,13 @@ # Resources -- [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 +- [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/ From 8316c8198f4eeb881c937268e23ffcb70572a895 Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Tue, 2 Jun 2026 22:03:27 -0700 Subject: [PATCH 6/7] Update shared help.md --- exercises/shared/.docs/help.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/exercises/shared/.docs/help.md b/exercises/shared/.docs/help.md index 7084ca8..85a2c9c 100644 --- a/exercises/shared/.docs/help.md +++ b/exercises/shared/.docs/help.md @@ -2,7 +2,10 @@ ## Useful resources -- [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 +- [ReScript Language Manual][language-manual] +- [ReScript for JavaScript Developers][rescript-for-js] +- [ReScript Forums][rescript-forums] + +[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 From ec0c23c65b1858e972f640c2890fc31922e5b6ea Mon Sep 17 00:00:00 2001 From: BNAndras <20251272+BNAndras@users.noreply.github.com> Date: Tue, 2 Jun 2026 22:05:30 -0700 Subject: [PATCH 7/7] Remove stray empty line --- docs/ABOUT.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/ABOUT.md b/docs/ABOUT.md index b670fd9..774629d 100644 --- a/docs/ABOUT.md +++ b/docs/ABOUT.md @@ -1,7 +1,6 @@ # About 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`.