Welcome to the ReScript Forum

Hello there :wave:

We are the ReScript community.

ReScript is a robustly typed language that compiles to efficient and human-readable JavaScript. It comes with one of the fastest build toolchains and offers first class support for interoperating with ReactJS and other existing JavaScript code.

Our Philosophy

ReScript is a language about shipping products, and we take pride for good UI and UX.

About the Forum

This is a friendly place for all kinds of questions and topics related to ReScript, this includes:

  • General / Beginner Questions (no formal structure required)
  • Q&A like topics (please use the “Solved” button on a reply if it solves your problem)
  • Feedback / Suggestions
  • Product Design topics
  • HTML / CSS / JavaScript topics

It’s important to emphasize that there are no silly questions, just create a new topic in the right category and the team and community is happy to chime in!

Code of Conduct

Please be sure to read and comply to our Code of Conduct. Keep discussions professional and friendly!


That’s all. Welcome to the community :tada:

- The ReScript Team

9 Likes

Hello everyone! I am new to rescript, what resources or books should i use to learn the language?

2 Likes

Welcome to ReScript!

The most up to date resource are the ReScript docs: https://rescript-lang.org/

There is a somewhat recent book: Introducing ReScript: Functional Programming for Web Applications | SpringerLink
The content is already a bit outdated though. Most notably there is no async/await, it is using the old standard libraries which are in the process of getting superseded by ReScript Core and it utilizes auto-currying a bit, which is not the default behaviour since ReScript 11.

And here is a collection of resources that I update every once in a while: GitHub - fhammerschmidt/awesome-rescript: A collection of materials about the ReScript programming language and toolchain.

I also want to highlight a more recent video course by @Exegetech here:

Last, but not least: use this forums search function (or just google) and if you don’t find an answer don’t hesitate to start a new forum thread and ask a question!

2 Likes

thanks alot. The tutorial on youtube is great.

hello there!
i am trying to get input from the command line from nodejs but i can’t seem to make it work.It telling me my type is option<'a> but this function argument is expecting type string

let result = switch input {
| Some(arg) =>
  switch Belt.Int.fromString(arg) {
  | Some(year) =>
    let leapYear = isLeapYear(year)
    let message = if leapYear {
      `${year} is a leap year`
    } else {
      `${year} is not a leap year`
    }
    Js.log(message)
  | None => Js.log("Invalid year input")
  }
| None => Js.log("No year input provided")
}
1 Like

Probably in your case input is a string type, but you try to switch on it as option.

1 Like

i just needed to put an option on the input

1 Like