Drawing tree in OCaml GUI, best option?

One follow up question, if a project needs to rely on npm somewhat, is js_of_ocaml still a good option?

My understanding is bucklescript allows easier access to npm libraries, and deals with project management as well, while js_of_ocaml is still used inside dune etc. I have yet to find info on how easy it is to use npm stuff in js_of_ocaml.

Thanks very much!

I’ve definitely used JavaScript libraries with js_of_ocaml, and that works fine. But npm integration as far as I know has only been put together with Bucklescript and bsb (the Bucklescript build system), and I don’t know much of the details. But it was pretty easy to grab a bundle off of npm, and then do the rest in js_of_ocaml. You can take a look at our virtual_dom package to see how it was done.


Awesome! Thanks very much for the reply and the pointer.

I only have experience with Bucklescript not with js_of_ocaml but my experience is quite good with it. If you have experience with js and the js ecosystem, I would probably check out Bucklescript.

Yep I would agree, I have been toying with Reason and Bucklescript for past 1-2 days, and the experience has been very smooth.

My only concern is that being stuck with OCaml 4.02.3 might cause issues later down the road for the project that I can’t foresee right now. So I’ll proceed with js_of_ocaml for now.

AFAIK, the work has started to move Bucklescript over to 4.06, these might be relevant: https://github.com/BuckleScript/bucklescript/issues/2755 and JS_of_OCaml vs Bucklescript

Thanks for the info!

Yep I bumped into the GitHub issue today, but since my project is due in a few months, I can’t really wait on it.

I have used it to make a UI used in the industry but it has a learning curve because aspects of it are not documented.

Did you like using it? Would you use it again if you had to do an OCaml app with a GUI?

I developed the binding method between QML with OCaml, so I’m probably biased, but I would use it again yes. I have had ideas to make it more straightforward but not the time, yet.

@orbifx Can you advertise QML itself?

Advertise QML itself? Qt project does a good job :yum:

What’s the overall idea?

QML objects emit parametrised signals for the various events they handle… During boot, we query the QML tree for objects of interest and we bind OCaml functions to these signals. There are some small things to watch out for. The cool thing with this approach is that it only requires QML + OCaml and generally no extra C++ code.

1 Like

Do you have code to do this already, @orbifx, or is it an idea at present? If you have the code, even in a bad state, you could release it and perhaps some of the rest of us could try documenting it and cleaning it with your help.

This works already. Or atleast it did with the version I worked with. It has been in proprietary code used industrially. There s a test file in the repo which can also serve as an example. Will post a link tomorrow.

My idea was to spin this off and have even been tempted about a pure Ocaml + QML library.

1 Like

Is it possible to open source just the Qt/QtQuick/QML portions?

If you are talking about the bindings then yes, they are here:


The test files I mentioned:


I’ve started a stand alone library too, but haven’t pushed it yet.

1 Like

Ah, @orbifx , I didn’t understand that you had contributed to the lablqml work. It is shared between you and @Kakadu ?

There’s also this:

that lets you run the vizualisation in your browser.