How to convert a bool to a string? Struggling. I tried: Hey it's a bool: ${myBool}, but no dice. I’ve looked in Js.String, and Belt, but didn’t see a bool to string.
string_of_bool is a part of Pervasives. You can just use it, e.g.
let x = true;
let y = string_of_bool(x);
let z = `y = ${y}`;
There’s a bunch of other helpers like this that are available, e.g. string_of_int, string_of_float (interestingly using this triggers a warning suggesting the use of Js.Float.toString instead), int_of_float, and float_of_int. All of these come from OCaml which ReScript is based on.
So Kevin, I swore I’ve seen some of these accidentally popup in code hints sometimes in VSCode. I think Yawar pointed me to where these things are documented before, but I lost it. Was it OCAML docs or something else? I feel like I’m missing out on a lot of functions I should be reading about.
Yeah because the OCaml inherited stdlib is supposed to be disabled by default in the future, as stated in the Roadmap for v10 (but will be accessible via flag for those who need it).