[Caml-list] Attn: Development Editor, Latest OCaml Weekly News

Alan Schmitt
2024-07-30T13:26:33Z

[-- Attachment #1: Type: text/plain, Size: 9970 bytes --]

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: <https://discuss.ocaml.org/t/ann-mlx-syntax-dialect/15035/1>

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 _ = <page title="Hello" content="World" />
└────

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] <https://github.com/ocaml-mlx/mlx>

[example with Dream]
<https://github.com/aantron/dream/blob/dc805cb46fd99001bc828cddb9de053a3dc464eb/example/w-mlx/README.md>

[example]
<https://github.com/andreypopp/melange-mlx-template/blob/main/src/ReactApp.mlx>

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] <https://github.com/ocaml-mlx/ocaml_mlx.nvim>

heml, a HEEx-inspired HTML templating ppx for OCaml
═══════════════════════════════════════════════════

Archive:
<https://discuss.ocaml.org/t/ann-heml-a-heex-inspired-html-templating-ppx-for-ocaml/15037/1>

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|<Layouts.layout title={title}>
│ <.heading text="Hello!" />
│
│ <%= List.iter (fun user -> %>
│ <.greet user={user} />
│ <%= ) ["Steve"; "Becca"; "John"]; %>
│
│ </Layouts.layout>|}
└────

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] <https://github.com/pjlast/heml>

[opam] <https://github.com/ocaml/opam-repository/pull/26297>

Forester 4.2
════════════

Archive: <https://discuss.ocaml.org/t/ann-forester-4-2/15043/1>

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] <https://stacks.math.columbia.edu>

[Kerodon] <https://kerodon.net>

[changelog] <https://www.jonmsterling.com/jms-00WK.xml>

[Forest] <https://www.jonmsterling.com>

[Forester 4.2 Release Notes] <http://www.jonmsterling.com/jms-00WK.xml>

First Robotics and OCaml - Do you know any local teams?
═══════════════════════════════════════════════════════

Archive:
<https://discuss.ocaml.org/t/first-robotics-and-ocaml-do-you-know-any-local-teams/15051/1>

jbeckford announced
───────────────────

For those who don't know, First Robotics is a competitive,
international high school league for robotics:
<https://www.firstinspires.org/robotics/frc>.

I've helped a couple students write "scouting" software partially in
OCaml and partially in Java:
<https://github.com/diskuv/scoutapps/tree/main?tab=readme-ov-file#sonic-scout-apps>

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:
<https://discuss.ocaml.org/t/ann-2nd-editor-tooling-dev-meeting-25th-of-july/14953/4>

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:
<https://github.com/ocaml/merlin/wiki/Public-dev%E2%80%90meetings>

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] <https://ocaml.org/blog/>

[Introducing tree-sitter-dune]
<http://blog.emillon.org/posts/2024-07-26-introducing-tree-sitter-dune.html>

[Creating the SyntaxDocumentation Command - Part 3: VSCode Platform
Extension]
<https://tarides.com/blog/2024-07-24-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] <mailto:alan.schmitt@polytechnique.org>

[the archive] <https://alan.petitepomme.net/cwn/>

[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>

[caml-list] <https://sympa.inria.fr/sympa/info/caml-list>

[Alan Schmitt] <https://alan.petitepomme.net/>

[-- Attachment #2: Type: text/html, Size: 22998 bytes --]