/exercism-rescript

Exercism exercises in ReScript.

Primary LanguageReasonMIT LicenseMIT

Exercism ReasonML Track

build status

Setup

First install npm (Node Package Manager) - you can do that from this site: https://www.npmjs.com/get-npm Follow the instructions under https://reasonml.github.io/docs/en/installation to install ReasonML.

Contributing

We welcome all contributions, both large and small.

Please read about how to get involved in a track. Be sure to read the Exercism Code of Conduct.

Fixes and improvements to existing exercises are welcome. Please note that this track's exercises must conform to the Exercism-wide standards described in the documentation. If you're unsure about how to make a change, then go ahead and open a GitHub issue, and we'll discuss it.

Exercise Tests

All Exercism exercises contain a test suite, which help to guide the user's implementation. You can read more about how we think about test suites in the Exercism documentation.

Tests should be written using bs-jest.

open Jest;
open Expect;

describe("Leap", () => {
  test("year not divisible by 4: common year", () =>
    expect(Leap.is_leap_year(2015)) |> toBe(false)
  );
  test("year divisible by 4, not divisible by 100: leap year", () =>
    expect(Leap.is_leap_year(1996)) |> toBe(true)
  );
})

Coding Style

Use PascalCase.re for Reason implementation file names. A Reason interface file (.rei) should be included with every exercise to help the user get started. Use refmt on your code before pushing.

Opening an Issue

If you plan to make significant or breaking changes, please open an issue so we can discuss it first. If this is a discussion that is relevant to more than just the ReasonML track, please open an issue in exercism/discussions.

Submitting a Pull Request

Pull requests should be focused on a single exercise, issue, or conceptually cohesive change. Please refer to Exercism's pull request guidelines.

Please use refmt to ensure a consistent coding style.

refmt --in-place Example.re

Verifying Your Change

Before submitting your pull request, you'll want to verify the changes in two ways:

  • Run all the tests for the ReasonML exercises. There is a top level Makefile, run: make.
  • Run checks on the repo using configlet. From the top level, run:
./bin/configlet lint --track-id reasonml .

Contributing a New Exercise

Please see the documentation about adding new exercises.

Note that:

  • Each exercise must stand on its own. Do not reference files outside the exercise directory. They will not be included when the user fetches the exercise.
  • Exercises may use any library subject to licensing restrictions, make sure dependencies are updated in the package.json file for the exercise.
  • Exercises must conform to the Exercism-wide standards described in the documentation.
  • Each exercise should have a test suite, an example solution, and build configuration files for node and Bucklescript. The CI build expects ReasonML files to be named ending in .re
  • Be sure to add it to the appropriate place in the config.json file.