How does one go about creating a UI framework in OCaml

For my final year project at university (for next year), I was thinking of starting a project in which I would design a music player with a UI (e.g. iTunes but smaller scale) in OCaml.

I have looked around on the internet at UI libraries, and I was wondering if there was a way for me to create a custom framework in OCaml, how easy that would be and what I should look into/start from.

Bear in mind that I am not an OCaml expert, I have done two years of it at university and I am aware that this task would probably require me to do a lot of research. I just wanted to get some information on the subject before I actually delve into my final year.

Check out reveryui (it is actually written in reasonml, not ocaml, but they are same except syntax)

3 Likes

There are at the very least two very ambitious final year project contained in this sentence.

If you choose to build a custom UI framework library, you most probably would not have the time to look at building a music player.

I would advise to focus on one objective at a time.

5 Likes

That said, this desire (to write GUI apps in OCaml) is pretty widespread, and there’s relatively little out there which is well documented and production worthy. But we all know that.

2 Likes

You’re probably looking for a desktop UI framework, but I’ve been playing with https://github.com/janestreet/incr_dom combined with a CSS only framework: https://bulma.io/

And it’s been pretty pleasant so far. Because of the incrementally of incr_dom things stay pretty fast. It does get a bit hairy when having to do certain native JS things because Js_of_ocaml’s API is a bit verbose. So maybe something to investigate if it fits your constraints.

3 Likes

Note, there is also lablgtk3 - be sure to use the ‘lablgtk3’ branch. CoqIDE, Frama-C, and few other projects use it. So it is kind of “production quality”.

2 Likes

You could write a mpd compliant music player, and use any existing mpd client with it.

I could and this would probably be fine if I just wanted to pass my module. I’m looking into something a tad more elaborate, is all.

I think it should be feasible with bogue:

I would not advise this for only getting your degree, of course, because bogue is not production ready; but if you want to get involved in the development of a GUI, it could be interesting.

1 Like