reasonml / reason-cli

Globally installable Reason toolchain.
MIT License
291 stars 23 forks source link

rtop only understands old function syntax #81

Open svoynow opened 6 years ago

svoynow commented 6 years ago

Not sure if this is the right place for this, or if this is a known issue:

Reason # let foo = fun(x) => x + 2;
let foo : int => int = <fun>                                                    
Reason # let foo = (x) => x + 2;
Error: Syntax error 
 $ rtop -version
The universal toplevel for OCaml, version 1.19.3, compiled for OCaml version 4.02.3

I know that "Try ReasonML" is preferred as a sandbox/repl solution, but I find rtop useful when explaining types to people.

brooklynrob commented 5 years ago

Disregard comment below, though leaving for context as to how I recreated the same problem @svoynow had. I am still having the same problem described above - (rtop only supports "old" Reason 2 syntax)

In my investigations I did notice that the dune-project file requires Dune 1.4, but isn't the latest version from Jane Street 1.2.1? Don't think it's related by I noted it.

I experienced the same problem just as described above by @svoynow today (2019.1.1) after installing Reason (via opam).

I was able to remedy by running opam update and then opam upgrade which hds the effect of upgrading menhir from the version tagged "20171013" to the version tagged "20180905". Once that happened, the new Reason 3 syntax worked in rtop.

@svoynow did you install via yarn/npm or via opam? As context I have/had existing OCaml switches and installed Reason via opam (on a separate 4.04.2 switch I created to segregate my Reason work) using the instructions here, https://github.com/facebook/reason/blob/master/src/README.md