I need to draw a knowledge tree of some form where the tree needs to be interactive. Basically just a tree of nodes that you can click on and do actions, hide, zoom in/out, move camera around etc.
Is this the best option in terms of time and ease of development?
The GUI does not have to be pretty, just needs to be prototype quality, which is why I don’t want to spend too much time on it as it shouldn’t be a big part of my project.
The GUI can also be in browser or in other UI or window of some form, as long as it can be opened on a computer.
Lexifi’s vdom and Jane Street’s incr_dom both seem like plausible approaches to me.
True, I just meant using
refmt and so on. No manual porting or anything yep.
Thanks very much for your suggestion, I didn’t know about those two options at all, I’ll experiment with them later.
I’ve also started playing with lablqml which is a set of OCaml bindings to the qtquick/qml part of Qt5, but it is too early for me to say if this is a viable approach to building UIs.
Not sure if you’ve seen these or if this would match your use case, but there are also js_of_ocaml bindings to some charting libraries:
Spiros’ ocaml-d3 is not actually typesafe, be warned. Modeling d3 properly in OCaml is tricky.
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!
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
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
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.