Hello,
I’d like to announce the first release of Brr.
The TL; DR is:
If you are looking for a productive way to program browsers with js_of_ocaml but without ppx and ghost OCaml objects, give Brr a try.
The details:
Brr is a toolkit for programming browsers in OCaml with the
js_of_ocaml
compiler. It provides:
- Interfaces to a selection of browser APIs.
- Note based reactive support (optional and experimental).
- An OCaml console developer tool for live interaction
with programs running in web pages.- A JavaScript FFI for idiomatic OCaml programming.
Brr is distributed under the ISC license. It depends on Note and on the
js_of_ocaml
compiler and runtime – but not on its libraries or syntax extension.
Homepage: https://erratique.ch/software/brr
API Docs & manuals: https://erratique.ch/software/brr/doc/ or odig doc brr
Install: opam install brr
Brr is essentially what I need to be productive for browser programming with js_of_ocaml: an obvious FFI with JavaScript objects as abstract data types without OCaml object phantom types and binding documentation precisely linking into MDN.
The OCaml console is the hack on the cake. In the past I often found it frustrating to have OCaml programs running in my webpages and be greeted with a JavaScript prompt in the browser dev tools. Quite a bit of polishing could be done on that though. Some of which should likely directly be done upstream in the toplevel machinery (e.g. identifier completion, a better toploop API and support for easy pretty printer installation). It would also be nice if we could cut down on js_of_ocaml
's toplevel compilation times ;–)
Parts of Brr have been seriously dogfooded in the past but that new incarnation is largely untested for now and certain APIs might need adjustements. Early adopters should study actual binding coverage, expect glitches and little breakages in the future.
The Note reactive functionality was also seriously used in the past but Note itself needs a new design round and I don’t have the ressources to do it right now, expect breakage, don’t pay too much attention to it for now.
My thanks to the js_of_ocaml
developers for the nice ocaml to javascript compiler and a special shootout to Hugo Heuzard for not getting mad at me when pinging him directly for questions.
Happy browser compatibility bug hunting,
Daniel