Advice on Reason/Rescript tools for my course

I teach an intro CS course, and need Reason/ReScript advice. I need to start with a little context.

We start the course with a little Racket to get students used to functional programming, and then want to move on to a language with explicit types and fewer parentheses :). We used Ocaml, but switched to Reason last year, which worked well. The fact that Reason compiles to something else (Ocaml, Javascript) frankly doesn’t matter much. The main advantages for us were the ability to use VSCode, and that setup was far easier than it had been for ocaml. The sketch.sh interactive-reason-environment turned out to be pretty useful too.

Three downsides for us were (1) the Pervasives library appeared to be pretty well implemented…except it turned out we couldn’t do I/O like “open this file and read from it.” (2) We never really worked out a nice way of printing out arbitrary values as sketch.sh does, which we’d have liked to use when students write test-cases. (3) Installing things involved tools whose purpose wasn’t always clear, and debugging students’ installations was sometimes a pain.

My plan for this year is to continue to use Reason syntax (unless playing with ReScript convinces me that it’s really a lot nicer), but I have to choose which “branch” of the recent division of Reason (ReScript or not-ReScript) is the best to go with for our purposes.

I’d appreciate informed opinions (which may well vary, of course) on the following (all in the context of relatively small programs):

  1. Is the installation and build-run cycle simpler on one branch than the other? And is the documentation of each one comparable?

  2. Does either branch have larger portions of Pervasives implemented? In particular, does one support file I/O or even standard-I/O?

  3. Do both have decent IDE support (e.g., does vscode play nice with both)?

Thanks in advance for any clarification that anyone can provide.

Hi,

the Pervasives library appeared to be pretty well implemented…except it turned out we couldn’t do I/O like “open this file and read from it.”

Could this be replaced by a highlevel IO library on top of nodejs for your course?
It should be pretty easy to implement highlevel APIs like readFileAsString etc.

(2) We never really worked out a nice way of printing out arbitrary values as sketch.sh does, which we’d have liked to use when students write test-cases.

The runtime encoding of ocaml values is much more idiomatic now, Js.log is good enough for debugging, I would be happy to help enhance the debug mode as well(the debug mode aims to provide the better experience using chrome custom object formatter)

(3) Installing things involved tools whose purpose wasn’t always clear, and debugging students’ installations was sometimes a pain

We aim to provide one click installation experience for Linux/Mac/Windows users, by just typing npm i bs-platform, would be happy to have a look if you have any issues.

Is the installation and build-run cycle simpler on one branch than the other? And is the documentation of each one comparable?

npm i bs-platform is the recommended way and much more tested.

Does either branch have larger portions of Pervasives implemented? In particular, does one support file I/O or even standard-I/O?

IO is not platform agnostics, we suggest you to implement a high level API on top of nodejs for education purpose.

Do both have decent IDE support (e.g., does vscode play nice with both)?

If your previous IDE is reason-language-server for vscode, I would recommend you to give rescript a try, its user experience should be on par or even better.

1 Like