User input in REASON


#1

I am attempting to obtain user input using REASON programming language. To compile ReasonML code to Javascript, I am using BuckleScript and executing it with “node”.

As per the documentation at https://redex.github.io/package/bs-readline16, I installed bs-readline using “npm i --save” command. Additionally, I added bs-readline to bs-dependencies in my bsconfig.json file.
However, Readline is still not being recognized.
How can I solve this and receive user input?


#2

The likely mismatch is the dependency name: the Redex page is for bs-readline16, so if that’s the npm package you installed, bsconfig.json should list “bs-readline16” in bs-dependencies, not “bs-readline”. After fixing it, run bsb -clean-world and bsb -make-world so BuckleScript regenerates the module mapping. If the compiler still says unbound module, check the package’s bsconfig.json for its actual name and whether it exposes Readline or a differently cased module, then use that module name in your .re file.