Hello, just a suggestion, if would awesome if we could execute code in the playground, not merely translate to JS. So beginners (like me) could visit the playground more often and play around with toy problems before transitioning to more advanced use.
The TypeScript playground also doesn’t have the option to execute, but it generates pure code (as far as I know) which I can copy paste to e.g. JSFiddle very easily. But the ReScript generated code often contains calls to foreign libraries. Or is there some one liner to import e.g. in JSFiddle exactly the function used in generated JS code?
Agree, this would be great!
As far as I’m aware (as far as basic execution goes), it does.
If you add some imports, you can execute the code in JSFiddle. The most important one is the runtime (rescript-std). e.g.:
import * as Curry from "https://cdn.skypack.dev/@firstname.lastname@example.org/lib/es6/curry.js";
You probably also need React:
import * as React from "https://email@example.com";
import * as JsxRuntime from "https://firstname.lastname@example.org/jsx-runtime";
Here is the playground example with es6 modules:
EDIT: And I guess the playground output will happen in the not so far away future: Playground output result by diogomqbm · Pull Request #420 · rescript-association/rescript-lang.org · GitHub
Thanks a lot! When I compare something like arrays in ReScript, I get
Caml_obj in the output. Where can I get this from?
Like Curry above:
import * as Caml_obj from "https://cdn.skypack.dev/@email@example.com/lib/es6/caml_obj.js";
just exchange the
./stdlib from the import in the playground with