Introducing Sketch.sh: An interactive sketchbook for OCaml and ReasonML

Hello everyone, over the past few months, I’ve been working on a little project called Sketch.sh. It’s a interactive notebook style (like IPython and Jupyter).

It uses Js_of_ocaml’s toplevel to evaluate the code completely in browsers. You can save/share the sketch with a url as well.

I created this with the hope to lower the bar for learning OCaml/ReasonML in general. There are a lot of sketch made by people who is learning the language already!

The project is open source on Github so check it out.

27 Likes

Hi this looks like an awesome tool. Thanks for creating it!

I just wanted to play around with it a bit and ran into something that’s not clear to me. I was expecting that switching from Reason to OCaml syntax would actually change the code. But it doesn’t do that?
So when you switch the example, the you get new syntax errors?

Thank you for playing with it.
Converting between Reason <–> OCaml syntax is being worked on. You can track it here: https://github.com/Sketch-sh/sketch-sh/issues/137

In the meantime, clicking on that button only change Toploop parser and outcome printer. Because the code is being executed after changing syntax, so you’ll see a syntax error at the moment.

1 Like

This is utterly awesome.

2 Likes

It is a very cool project. What libraries are installed? It would hope for the ability to at least optionally add libraries like core_kernel or base or batteries.

1 Like

How about the everything? https://github.com/ocaml/opam-repository/issues/12517#issuecomment-416106538

I’m currently working on the integration and prebuild a large set of handpicked libraries. but once the issue was resolved, I can support the whole opam registry (well, only what jsoo can compile)

6 Likes

Quick update: converting between ReasonML and OCaml has been deployed to main website. Now when changing language, the code will be converted automatically.

7 Likes

Well done @thangngoc89 it’s an amazing tool!
I suggest that you add a mention to your tool on awesome-ocaml on GitHub, it will help newcomers to discover it!

Wow awesome! Thank you for this massive effort. There goes the rest of my weekend …