Hello Here is the latest OCaml Weekly News, for the week of July 23 to 30, 2024. Table of Contents ───────────────── .mlx syntax dialect heml, a HEEx-inspired HTML templating ppx for OCaml Forester 4.2 First Robotics and OCaml - Do you know any local teams? 2nd editor tooling dev-meeting: 25th of July 🧙 Other OCaml News Old CWN .mlx syntax dialect ═══════════════════ Archive: Andrey Popp announced ───────────────────── Dear OCaml community, it is my pleasure to announce a release of [.mlx] dialect. The .mlx dialect extends OCaml syntax with JSX expression construct, following the example of JSX in JavaScript/ReasonML. A brief snippet: ┌──── │ let page ?(encoding="utf8") ~title ~content = │ │ │ title │ │ │ content │ │ │ │ let _ = └──── The main use case is to make it easier to describe user interfaces with OCaml, which can range from generating HTML ([example with Dream]) or describing interactive UIs with ReasonReact ([example]). [.mlx] [example with Dream] [example] Installation and usage ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ Install the packages from opam: ┌──── │ opam install mlx ocamlmerlin-mlx └──── Then configure dune to use the `mlx' preprocessor: ┌──── │ (dialect │ (name mlx) │ (implementation │ (extension mlx) │ (merlin_reader mlx) │ (preprocess │ (run mlx-pp %{input-file})))) └──── Now files with `.mlx' extension will be treated as OCaml modules. The merlin/ocamllsp users will get roughly the same level of support for `.mlx' syntax as they get for `.ml' but some additional text editor/IDE configuration is needed to associate `.mlx' files with merlin/ocamllsp. For neovim users there's a plugin [ocaml-mlx/ocaml_mlx.nvim], which does that bit of a configuration and provides highlighting for `.mlx' files based on a tree-sitter parser. [ocaml-mlx/ocaml_mlx.nvim] heml, a HEEx-inspired HTML templating ppx for OCaml ═══════════════════════════════════════════════════ Archive: Petri-Johan Last announced ────────────────────────── I've been working on [heml], a PPX extension that allows you to build complex HTML templates directly in your OCaml code. It's a direct implementation of Elixir Phoenix's HEEx templates. The README on GitHub has an example video of what it looks like in the editor and a bunch of example code, but here's a short snippet for convenience: ┌──── │ (* layouts.ml *) │ let layout ~title contents = {%heml| │ │ <%s= title %> │ │ <%raw= contents %> │ │ |} │ │ (* main.ml *) │ let heading ~text = {%heml|

<%s= text %>

|} │ │ let greet ~user = {%heml|

Hello, <%s= user %>

|} │ │ let () = │ let title = "Hello, OCaml!" in │ print_endline {%heml| │ <.heading text="Hello!" /> │ │ <%= List.iter (fun user -> %> │ <.greet user={user} /> │ <%= ) ["Steve"; "Becca"; "John"]; %> │ │ |} └──── heml differs from other templating solutions by allowing you to call OCaml code directly in the template, which is extremely useful for looping and conditional rendering. You can also create and call your own components/layouts. heml leverages the OCaml LSP for accurate in-line errors, and the templates are parsed and compiled into a series of Buffer writes which returns a string at runtime. I'm still waiting for it to be released on [opam], but thought I'd share it in the meantime in case anyone would be willing to check it out and provide feedback :slight_smile: . [heml] [opam] Forester 4.2 ════════════ Archive: Jon Sterling announced ────────────────────── I am pleased to announce the release of Forester 4.2 on opam, which is an OCaml utility to develop “Forests”, which are densely interlinked mathematical websites / Zettelkästen similar to the [Stacks project] or [Kerodon]. You can see the [changelog] on my own [Forest]. This release adds many new features and improvements, including: ⁃ First-class functions and lazy arguments, which can be used to implement more ergonomic MathML macros. ⁃ A new query language, which is now expressive enough to encode the backmatter ⁃ Improved performance of graph analysis (2x overall speedup rendering my own forest) To see other features and documentation of breaking changes, please view the [Forester 4.2 Release Notes]. My thanks to @kentookura and Jinser Kafka for their contributions to this release. [Stacks project] [Kerodon] [changelog] [Forest] [Forester 4.2 Release Notes] First Robotics and OCaml - Do you know any local teams? ═══════════════════════════════════════════════════════ Archive: jbeckford announced ─────────────────── For those who don't know, First Robotics is a competitive, international high school league for robotics: . I've helped a couple students write "scouting" software partially in OCaml and partially in Java: It is a very /very/ slow season for robotics teams, but if your local high school participates now is a great time for the mentors of that team to get ready. If you know a team that needs scouting software and want to help spread OCaml to your local neighborhoods … please direct message me. 2nd editor tooling dev-meeting: 25th of July 🧙 ═══════════════════════════════════════════════ Archive: Continuing this thread, vds announced ───────────────────────────────────── Thanks a lot to all participants and speakers, it was a very nice and interesting meeting ! You can find the meeting notes here: With the summer (/winter) break coming for a lot of us, the next meeting will take place in September. We will implement a call-for-presentation and a poll to choose meeting times by then. Don't hesitate to tell us right away if you would like to give a presentation or if you have subjects that you would like us to take on. (@andreypopp would you be interested in talking about melange and how it integrates with editor tooling ?) Other OCaml News ════════════════ From the ocaml.org blog ─────────────────────── Here are links from many OCaml blogs aggregated at [the ocaml.org blog]. • [Introducing tree-sitter-dune] • [Creating the SyntaxDocumentation Command - Part 3: VSCode Platform Extension] [the ocaml.org blog] [Introducing tree-sitter-dune] [Creating the SyntaxDocumentation Command - Part 3: VSCode Platform Extension] Old CWN ═══════ If you happen to miss a CWN, you can [send me a message] and I'll mail it to you, or go take a look at [the archive] or the [RSS feed of the archives]. If you also wish to receive it every week by mail, you may subscribe to the [caml-list]. [Alan Schmitt] [send me a message] [the archive] [RSS feed of the archives] [caml-list] [Alan Schmitt]