Just began with Reason and OCaml today. I've started with the https://github.com/esy-ocaml/hello-reason sample. I want to make a HTTP API call so I've installed ocaml-cohttp with: esy add @opam/cohttp-lwt.
Now I want to use that library (or any that you may have as a suggestion) within the hello-reason getting started sample.
I can't find reference documentation on how to import it. I've tried:
open cohttp-lwt
Can I use OCaml libraries within in Reason code files?
Yes, the only difference is syntax. The client tutorial can be translated directly, and automatically into this:
Edit:
hello-reasonuses ocaml-dune, so you also have to addcohttp-lwt-unixto thelibrariesstanza in the project'sdunefile, as shown in the client tutorial here.