-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation and example about IO operations #462
Comments
Hi @blaiseli Great question and hope you found a answer since it is some time ago, but I will add my answer still :) It is very much up to what backend you choose, if you choose to run it with JavaScript you would have to look into how Node.js reads from STDIN, something like this:
And somebody did create the bindings for the readline native node.js package. You can also look into how to create it with OCaml, which you can find more about here, although reasonml mostly focuses on javascript as you have seen in the docs, the bucklescript documentation has ocaml syntax you can switch to: Hope that helps or else please write again here! |
Hi @kevinsimper Thanks for your answer. Actually, I'm not planning to use the JavaScript backend. I was interested by ReasonML because it looked like a promising language to have access the power of OCaml with an easier syntax. I found some solutions and posted some of them here: https://stackoverflow.com/a/53223872/1878788. However, I realized that maybe I should rather try to learn OCaml directly, since ReasonML seems mainly directed towards web programmers. |
@blaiseli Yeah, learning ocaml directly would give you a better learning path, if the target is ocaml and not bucklescript. There is things that tries to make it easy to use reasonml and package land like https://github.com/esy/esy but it still requires you to know about compilation and such :) |
I'm surprised how hard it is for me to understand how to write a simple program that reads from stdin or from a file and processes the data line by line.
Just after the basic syntax rules and a hello world program, to start doing some real work, I need to interact with the outside world. However, I was unable to find anything on this subject in the documentation, and I struggle understanding how to do it looking at the various modules listed in the API Where should I look? Stream, Bytes, Pervasives, Unix? Should I learn OCaml and Javascript before attempting to do some real work with ReasonML?
A documentation chapter about IO would be welcome.
The text was updated successfully, but these errors were encountered: