OCaml In Browser REPL w/ DOM Bindings?

I know OCaml has a command line REPL.

I also know that OCaml can target JS (Js_of_OCaml, Bucklescript, ReasonML).

My question is: Does OCaml have an:

  • in browser REPL (so we’ll be typing in a textarea in a Chrome window, and my results are also in the same browser window)

  • with DOM bindings (so we can open a Svg / Canvas / WebGL context, issue draw commands, register mouse/keyboard handlers)

I’m basically looking for the “JS Developer Console”, except have it in OCaml.

1 Like

Yes. you can do that with Js_of_ocaml and it’s DOM bindings.

Check it out https://ocsigen.org/js_of_ocaml/3.1.0/manual/files/toplevel/index.html

3 Likes