43 comments

[ 0.26 ms ] story [ 22.2 ms ] thread
Looks like it's Web-only, no mention of the native UI support (terminal UI excluded).
Oh it needs a userland trampoline!

> JSOO does not have tail call optimization

The "Why Bonsai?" I found really funny.

Let me re-write that section for you:

Why Bonsai?

At Jane Street we're super excited by Functional programming and by CAML in particular, so when we need low latency software, we use OCAML, when we need hardware, we write out own langauge - HardCAML, and when we need a Web UI, we build a Web UI framework in CAML. Because we fucking love CAML.

I wish there were more OCaml shops out there
This would of been cool back in 2014.
Actually let me correct you. Its cool now because early 2000's is back on trend baby
> And because Bonsai is written in OCaml, it becomes possible to use the same language and types on both the backend and frontend.

Finally! I was waiting for this to become possible!

I don't think someone mentioned yet, but the (now defunct?) company Outrun Labs built a product Revery which seems almost exactly like what Jane Street has done (to my amateur eyes). OniVim was their only end user product afaik, built on this tech.
All your money and retirement funds are safe; I’m too dumb to work at JaneStreet; every time I see OCAML I feel less than and confused.
Aww thanks folks. All the downvotes to this means folks don’t think I’m dumb and also don’t like the self deprecating humor.
It's also a way to retain employees. If you are an expert ocaml writer, you aren't a drop in replacement at the competition. So while I'd love to work there, a lot of the knowledge isn't very marketable after you move on.
Not sure why, but reminds me of Fog Creek's Wasabi.
Curious how this compares to Melange which is used by Ocaml shops as well to double up on Ocaml for both front and backend (ahrefs being the major user and sponsor). Does this mean giving up a lot of the JS ecosystem (React, graphql, etc)?
A good GraphQL server and client should be relatively straightforward to make in OCaml. Especially if you start from the premise that fragment spreads compose, rather than inherit.

Relay’s (second) compiler was prototyped in OCaml, but we ended up switching to Rust for the main rewrite in the belief that we’d be able to use the same runtime code across iOS, Android and JS environments.

Please somebody make a good OCaml GraphQL compiler, server, and client.

I've been using Resgraph, but it's based off Rescript, a fork of ocaml.
It looks like a nice little library; but oh boy must this be so limiting for the product teams that are forced to use. Everything looks like it's straight out of the 1990s.
What do you mean? What's the connection with the product teams? Why would product teams care what low level web framework is used?
Which is fine if you are building tools for financial professionals. It is the aesthetic of choice. And is generally very functional for this purpose.
The “The thinking in bonsai” link 404s.

This says it is based on Elm. So it has the same clean immutable state structure?

I am sure it's very performant, but to me it's extremely ugly; Surely someone can fix margins and still have it be performant.
Can someone who understands web UI programming tell me if this would be good for my local agent to use to produce HTML based reports and outputs for me? Or for TUI outputs?
Why does this library get posted here, what feels like every month? I remember it seeing at least twice before.
This is great. It focuses on utility and information density over design. It looks like someone took a terminal UI and transplanted it to the web, Bloomberg terminal style.

I'm pretty sure you can build tools with this that are fast and pleasant to use.

Interesting! What are Bonsai's dependencies? I use OCaml but - so far - none of Janestreets libraries etc.
I really want to like OCaml. One day I'll get around to learning it.
It might be a very performant UI framework in OCaml, but all the UI elements look extremely unpolished to me, like what a really smart high-school kid would build the GUI for his side project on Windows in 90s.

Thanks, I can use JS as a functional programming language.

Windows and especially Macintosh UIs from the late 90s/early 00s were by far the most functional UIs we've ever had since the dawn of the desktop era - user research was a serious discipline, accessibility was baked in to the frameworks, and the HID guidelines that devs adhered to gave us uniform conventions that we users could rely on.

If the biggest criticism of Bonsai is "it ain't pretty but it works", then long life to Bonsai - give me more, please!

Did you maybe confuse bonsai with a CSS library? How to build web UI != How to style HTML. Bonsai solves a different problem.
(comment deleted)
What does JaneStreet do besides sponsoring nerdy Youtube channels and writing UI libraries?
manipulate foreign equity markets
Considering how ridiculously verbose their library is compared to React/Vue it's a good thing we have LLMs to deal with the boilerplate now.
The docs directory happen to be missing, therefore the links to the quick guide and to "thinking in bonsai" pages from the readme are broken.

Also, I'm wondering how does bonsai-web update the DOM, is it via direct modification of the changed elements, or via some DOM differ? I'd say from direct update from a quick look at the source, but I'm unsure.

How on earth is this a web UI Library and yet there is no link to any sort of example page (like a github.io page or something) showing this off?
A more practical question: has anyone used this in production in internal apps at work? UIs like this look nice and have a flare that I like, but I guess it feels weird if I want to introduce this with my team over something like tailwindcss and rolling our own components