[ANN] Functional web applications running in the browser

I am pleased to announce the first release of the library fmlib_browser.

If you want to write functional web applications running in the browser the library fmlib_browser might interest you. It allows web applications in the elm style using the much more powerful language ocaml.

I have discovered the elm language some years ago and I am convinced that this kind to write web applications is one important future way to develop web applications. So I wanted to have the same in the ocaml language. Therefore I have developed this library (and of course using js_of_ocaml as the compiler to javascript) and I am quite happy that it works well.

Some simple examples of web applications and the corresponding source code written by using the library fmlib_browser.

Install the library via opam by issuing the command

opam install fmlib_browser
14 Likes

Hello @hbr, thanks for sharing your project :slight_smile:

Did you know about ocaml-vdom before creating this lib?

If yes, why did you create it? How does it differ?

@benjamin-thomas: I know the project ocaml-vdom and the basic idea with respect to virtual dome is very similar. However I wanted to have something more generic.

If you look into the interface of ocaml-vdom you see that e.g. the event handlers are limited to the definitions in the library. With Fmlib_browser you can customize your event handlers completely. My event handlers use elm’s generic concept of decoders to suck any information you want from the events.

The properties in my library are generic. You can create arbitrary javascript value including objects and arrays. In ocaml-vdom you are limited to primitive values like int, float, string and bool.

Furthermore I wanted to have a pretty generic interface between the javascript world and the ocaml world.

The concept of Fmlib_browser is extendible. In the future I want to add features e.g. to start web workers, integrate custom elements to have access e.g. to code mirror.

2 Likes

Sounds compelling :slight_smile:

If you have the time, it’d be great if you could implement the 7 GUIs tasks to serve as example code to your lib.

https://eugenkiss.github.io/7guis/

I find this benchmark quite good: small enough in scope not to be a time sink, but complex enough to make one understand the limitations or advantages of a language or library

3 Likes

Thanks for the hint to the 7 gui examples. The next time I work on the library I am going to implement the examples. Basically I don’t see any problem, just work to do.

1 Like

I have implemented some of the examples:

The last two examples of the benchmark are still missing. You can find the sources at: https://github.com/hbr/fmlib/tree/browser/src/examples/browser

Regards
Helmut

Excellent!

I had a look at the code and the way it’s structured does feel very familiar to me :slight_smile:

It’s quite surprising how much so actually :+1: