riju icon indicating copy to clipboard operation
riju copied to clipboard

ReasonML: rtop REPL

Open raxod502 opened this issue 3 years ago • 1 comments

imported comment by @kwshi

Riju currently says ReasonML has no REPL. That's not fully true--technically, ReasonML does have a REPL named rtop. What is true is that BuckleScript, the OCaml-to-JS transpiler that is most often used in conjunction with ReasonML, doesn't provide an interactive/REPL interface, so ReasonML/OCaml in the JS runtime has no REPL (see #48 for a more thorough discussion of the various runtimes for ReasonML/OCaml). So rtop only runs via the native runtime and does not provide any access to the JS bindings provided by Bucklescript.

Here are three options to setting it up (there may be more):

  • Via OCaml's official package manager opam. OPAM needs to be first initialized with opam init before anything is installed, as you're probably aware; after that, running opam install rtop will install the rtop executable to <opam_switch>/bin/rtop (where <opam_switch> is most commonly ~/.opam/default).
  • Via NPM, the reason-cli npm package.
  • Via Esy, which, as far as I can tell, is geared towards the native ReasonML runtime and therefore comparable to OPAM but provides a more npm-esque tooling interface and adds access to NPM-hosted OCaml native packages. It itself needs to be first installed via npm install -g esy; then, rtop can be installed via either esy add reason-cli (alias to NPM package) or esy add @opam/rtop (alias to OPAM package). I'm not sure whether using Esy adds much value to the Riju use case, but I'm putting this approach here as reference anyway.

raxod502 avatar Jun 15 '21 05:06 raxod502

Excellent, thanks for the pointers. This sounds like a great idea.

raxod502 avatar Jun 15 '21 05:06 raxod502