Setting up reason-cli, first Steps with rtop and Editor Support in Reason

Nik Graf
InstructorNik Graf
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 6 years ago

In this lesson we setup the ReasonML repl rtop, evaluate our first statement and explore rtop's most important features like reverse search through multiple lessons. We finish up with a demonstration of Reason's formatting tool refmt in the editor Atom.

Instructor: [00:00] In this course, we're going to focus on the core language. To do so, we're going to install the Reason CLI tool globally. Up-to-date instructions, which command to run, can be found at the Reason website, navigating to global installation.

[00:14] I'll copy and paste the command in the terminal and run it. This installs, and full of tools, like Reformat and Merlin. Just import Reason in your editor. Also, the interactive command line tool, RTOP. RTOP is the perfect companion for us trying out the language. Let's get started, and give it a try.

[00:34] We type in one plus one, add a semicolon, and hit enter to evaluate the line, and see the result. In RTOP, the output of every evaluation consists of three parts. The most left part indicates a let binding, which I will explain in a coming lesson. It is followed by a colon and the type definition.

[00:54] Next comes an equals sign with the result of the evaluated code. In RTOP, the semicolon also triggers evaluation, but semicolons are also a required part of the language to separate imperative statements. As you might already have noticed, there's a list always below. It autocompletes with possible options of modules and functions we can use.

[01:17] By the way, when we print out the value, we see the value, and then the output of the evaluation. Depending on the print function, it can be the same or the next line. What's also really useful is reverse search in RTOP, even across multiple sessions. Press Control+R, and we can search for the history.

[01:37] Regarding editor support, I recommend to check out the website instructions. Whatever editor you decide to go with, I highly recommend to enable Reformat, which autoformats your code. Now, you are familiar with the basic tooling, and we can get started exploring the language.

egghead
egghead
~ 7 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today