Bonsai: Janestreet's UI Library(github.com)
370 points by KolmogorovComp 1 day ago | 149 comments
tl;dr: Bonsai is Jane Street's OCaml-based UI library, inspired by Elm, used to build most of their internal web applications. Unlike React-style frameworks, it decouples state, incrementality, and rendering into composable primitives managed outside the component hierarchy, and leverages OCaml's type system across frontend and backend. It also features a robust testing system for programmatically manipulating UI and inspecting DOM diffs, plus variants for terminal UIs (Bonsai_term) built on a generic incremental state machine core.
HN Discussion:
  • Excitement about using OCaml types across frontend and backend
  • Questions comparing Bonsai to alternatives like Melange and impact on JS ecosystem access
  • Criticism of the UI's visual design and aesthetics
  • Technical curiosity about implementation details like DOM updates and dependencies
  • ~Skepticism about practical adoption outside Jane Street's internal use