> And because Bonsai is written in OCaml, it becomes possible to use the same language and types on both the backend and frontend.<p>Finally! I was waiting for this to become possible!
There's also Fable for F# but I believe this commenter is being sarcastic. Javascript is a common backend language.
A really great place to reach for this is Elixir/Phoenix now that the set theoretic type system is in place with LiveView. I have been doing some pretty large/complex codebases gradually working towards fully integrating working this way for the past 5 years and it has been great.
Similar attempts include Scalajs.<p>The general challenge becomes integrating the fractional front-end code written in your backend-language that compiles to JS with the rest of the JS ecosystem.<p>JaneStreet have a love of writing their own stuff from scratch so it doesn't apply to them but it might to you.<p>Hence most people end up with frontend-as-backend rather than backend-as-frontend.
KotlinJs and ClojureJs too. You always end up having to write wrappers or dealing with problems that would just work if you just used normal js/ts.
Yup, and Clojure/ClojureScript!
Couldn't WASM solve that problem once and for all? Is there some limitation that WASM has that JS doesn't?<p>Disclaimer: I am very inexperienced at front-end development.
> Is there some limitation that WASM has that JS doesn't?<p>You need a JS trampoline to call your WASM and make browser primitives available to it, and IIRC calls into browser code incur some extra overhead, but those are pretty manageable.<p>Additionally: for high level languages, source code is _much_ smaller than compiled binaries. If your initial needs are simple, your users are likely downloading more than 10x as much code.
WASM does not (yet) have access to the DOM or web APIs, meaning every direct interaction with the browser must first go through JS interop anyways, with a resulting performance penalty. There are proposals, and maybe we'll see it happen by 2035, but as of now WASM is best suited for heavier workloads where the edge in application performance outweighs the cost of JS interop with the browser rather than being a universal solution.
Such attempts are quite common. Some I remember:<p><a href="https://ocsigen.org/" rel="nofollow">https://ocsigen.org/</a> in Ocaml too<p><a href="https://websharper.com/" rel="nofollow">https://websharper.com/</a> for fsharp and csharp. Really good when I used in in fsharp<p>Maybe <a href="https://melange.re/v7.0.1/" rel="nofollow">https://melange.re/v7.0.1/</a> too? (Not sure)
> Finally! I was waiting for this to become possible!<p>Sarcasm?<p>Do you want to have a talk as to why JaneStreet wasn't built on JavaScript?
There's a great Signals and Threads (Jane Street's Podcast) episode about this work: <a href="https://signalsandthreads.com/building-a-ui-framework/" rel="nofollow">https://signalsandthreads.com/building-a-ui-framework/</a>
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.
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)?
Interesting! What are Bonsai's dependencies? I use OCaml but - so far - none of Janestreets libraries etc.
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?
The main thing that Bonsai gets you is a nice programming model for making your UIs interactive. If you're mostly producing static reports (with maybe some basic interactive visualization widgets or something), it will not get you much over generating some variant on HTML + JS.<p>It makes more sense for applications where you have complex interactive logic in the UI, with a lot of different components that need to control and display some shared state.
There was this submission two months ago: <a href="https://news.ycombinator.com/item?id=48365904">https://news.ycombinator.com/item?id=48365904</a> . Basically they have a TUI frontend for the same thing. And the blog post says: "Bonsai_term would feel familiar to anyone who’d ever done web development here, and it had the huge advantage of being especially amenable to AI assistance. It was actually somewhat of a mystery to us how good the models were at writing Bonsai_term code, given how relatively obscure it is [...]"
Probably not, because your agent won’t have much info about this tool in its training set.
What does JaneStreet do besides sponsoring nerdy Youtube channels and writing UI libraries?
Jane Street made it's way into today's Wall St Journal for its quantitative prowess and hiring of Math PhD's. What was stunning to hear was that their 2nd quarter profits were a record $10.3 billion, nearly double that of Goldman Sachs and Morgan Stanley (much larger firms).
They're a trading firm that hires really clever people to use math to trade. Their strategies are, presumably, very complicated and ever changing, and secrecy about them is the point - you get bigger margins for longer if people don't learn about your 'one weird trick' (that and also that there is presumably another side to your trades losing out on upside, and they might not be best pleased to learn about it.
They’re a market maker
Print money?
Market manipulation. They got kicked out and banned from the asian markets for fraud.<p>EDIT.<p>Janestreet PR team is downvoting. Like always, radio silence and just downvotes.<p>I had expected more from janestreet.
This doesn't seem quite as clear-cut as you're making out.<p>The Securities and Exchange Board of India (SEBI) have accused Jane Street (JS) of market manipulation, JS claims it was legitimate arbitrage, and the case is still ongoing [1].<p>As I understand it, the ban only applied to Indian securities (not Asian markets as a whole), and was lifted back in July 2025 after JS paid ~$560 million (the alleged ill-gotten gains) into an escrow fund. They don't appear to have resumed trading, though [2].<p>[1]: <a href="https://www.reuters.com/legal/government/us-trading-firm-jane-street-files-appeal-against-india-markets-regulator-2025-09-03" rel="nofollow">https://www.reuters.com/legal/government/us-trading-firm-jan...</a><p>[2]: <a href="https://www.reuters.com/sustainability/boards-policy-regulation/jane-street-gets-approval-resume-trading-india-after-567-million-deposit-2025-07-21" rel="nofollow">https://www.reuters.com/sustainability/boards-policy-regulat...</a>
The above might be too far-fetched as it only applied to India? They did pay a fine to the regulator and resumed trading (might not be the same strategy though)<p>To OP’s original question, they made $20B last year and have a niche in several financial products
Trading the underlying to offset your derivative position isn't fraud.
>Janestreet PR team is downvoting. Like always, radio silence and just downvotes.<p>You're being downvoted for having a needlessly confrontational underinformed hot take on a quant trading firm that is essentially a market maker.
Looks like it's Web-only, no mention of the native UI support (terminal UI excluded).
Not sure why, but reminds me of Fog Creek's Wasabi.
Oh it needs a userland trampoline!<p>> JSOO does not have tail call optimization
Jsoo supports self-recursive and mutually recursive tail calls, but for general tail calls it would need to trampoline every single call, since the only major browser with proper tail calls is Safari.
I really want to like OCaml. One day I'll get around to learning it.
The “The thinking in bonsai” link 404s.<p>This says it is based on Elm. So it has the same clean immutable state structure?
I wish there were more OCaml shops out there
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.<p>I'm pretty sure you can build tools with this that are fast and pleasant to use.
This would of been cool back in 2014.
Ocsigen and Eliom were started 2005 and are pretty similar, although I can't find any well-known projects using Eliom :/.<p>Presumably this has learned some lessons from it, so it's probably better.
The "Why Bonsai?" I found really funny.<p>Let me re-write that section for you:<p>Why Bonsai?<p>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.
And there's nothing wrong with that. Many languages attempt to do the same thing. Why bother with 15 different languages if you can leverage one?<p>See also LiveView and Hologram for Elixir.
Agreed, looks like it's reinventing the wheels. Frameworks does not really matter today, AI agents write the code anyway.
But AI do benefit a lot from a strict compiler, and having a simple language improve a lot on type-safety, so I don't think it is to throw, even today.
But what about compilation speed? Hot reload? Maintainability? What is the bus factor for these kind of technologies?<p>Yea, its cool to have strict type safety, but what's the point of it doesn't have all the benefits from other Frameworks that took years to polish
JaneStreet has enough free cash to not worry about those issues. If one of their key persons dies in service, they can go out and contract the worlds leading expert in that domain, and their annualised rate isn’t even a rounding error on their bottom line.
ocaml has excellent compilation speed, and in my experience the code is very maintainable due to the module and type systems.
AI certainly writes Internet comments so that the flock does not have a single minute to get independent thoughts.
Better frameworks will still help AIs avoid silly mistakes. A smarter framework means you can be productive with a dumber/cheaper AI.
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.
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.
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.
Related:<p>Janestreet was banned from asian markets for market manipulation. They took in billions and fisted the average-joe investor. As a high profile ocaml user that casts a big shadow on ocaml too, as many involved in janestreet are also part of ocaml core team in some way.<p>I wont buy ignorance, as devs clearly know whats going on, so staying silent is pretty much being just as guilty.
If you read up on it that was basically India protecting its corrupt cronies. Janestreet showed severe problems with some Indian companies and instead of fixing that and creating a healthier and more transparent market they decided to go after the messenger.
Why did you feel the need to post this same comment multiple times? Seems a bit suspect itself!
Why does this library get posted here, what feels like every month? I remember it seeing at least twice before.
Been here 5 years, never saw it
HN is obsessed with anything done in niche programming languages, is my guess.
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.<p>Thanks, I can use JS as a functional programming language.