Hello Here is the latest OCaml Weekly News, for the week of December 17 to 24, 2024. Table of Contents ───────────────── dream-html and pure-html Dune 3.17 First release candidate of OCaml 5.3.0 Pragmatic Category Theory | Part 3: Associativity ocaml-stk, xtmpl, stog, ocaml-css, ocaml-ldp, higlo and chamo MirageOS on OCaml 5 Dune dev meeting Other OCaml News Old CWN dream-html and pure-html ════════════════════════ Archive: Yawar Amin announced ──────────────────── [ANN] dream-html 3.8.0 Happy to announce some added power to the form decoding functionality. Three main things: 1. Added [Dream_html.form] and [query] helper functions to wrap extracting the data directly from the Dream request and decoding it correspondingly from the body or query. 2. Added the (monadic) chaining operator [Dream_html.Form.( let* )] and [ok] and [error] helpers to allow sophisticated sequential decoding where decoding of some fields depend on others. 3. Added optional parameters to constrain [typed decoding] of values eg `int ~min:0' will succeed the decode if the value is an integer _and_ at least 0. Also added [unix_tm] type decoder to decode timestamps into `Unix.tm' structs (not timezone-aware). The last [example] on the page shows a fairly sophisticated form decoder which requires an `id' field and _one or more of_ the fields `days', `weeks', `months', and `years', and fails if at least one is not provided. Enjoy :slight_smile: [Dream_html.form] [query] [Dream_html.Form.( let* )] [ok] [error] [typed decoding] [unix_tm] [example] Dune 3.17 ═════════ Archive: Etienne Marais announced ──────────────────────── The Dune team is happy to announce the release of Dune `3.17.1'! :camel: This patch release includes some bug fixes. To reduce computing time, it does not build `.cmxs' files anymore when the `(no_dynlink)' stanza is used. This change also corrects the semantic of the `(no_dynlink)' stanza which was building `.cmxs' files even if it did not install them. Now, it does not build nor install them. If you encounter a problem with this release, you can report it on the [ocaml/dune] repository. [ocaml/dune] Changelog ╌╌╌╌╌╌╌╌╌ ◊ Fixed • When a library declares `(no_dynlink)', then the `.cmxs' file for it is no longer built. (#11176, @nojb) • Fix bug that could result in corrupted file copies by Dune, for example when using the `copy_files#' stanza or the `copy#' action. (@nojb, #11194, fixes #11193) • Remove useless error message when running `$ dune subst' in empty projects. (@rgrinberg, #11204, fixes #11200) First release candidate of OCaml 5.3.0 ══════════════════════════════════════ Archive: octachron announced ─────────────────── The release of OCaml 5.3.0 is imminent. As a final step, we are publishing a release candidate to check that everything is in order before the release in the upcoming week(s). If you find any bugs, please report them on [OCaml's issue tracker]. Compared to the second beta, this release candidate contains a regression fix in the type system (some type expressions were not generalized when they ought to be), one fix for the new check for dependency order at link time, and a manual update. The full change log for OCaml 5.3.0 is available [on GitHub]. A short summary of the changes since the second beta release is also available below. [OCaml's issue tracker] [on GitHub] Installation Instructions ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ The base compiler can be installed as an opam switch with the following commands on opam 2.1 and later: ┌──── │ opam update │ opam switch create 5.3.0~rc1 └──── The source code for the release candidate is also directly available on: • [GitHub] • [OCaml archives at Inria] [GitHub] [OCaml archives at Inria] ◊ Fine-Tuned Compiler Configuration If you want to tweak the configuration of the compiler, you can switch to the option variant with: ┌──── │ opam update │ opam switch create ocaml-variants.5.3.0~rc1+options └──── where `' is a space-separated list of `ocaml-option-*' packages. For instance, for a `flambda' and `no-flat-float-array' switch: ┌──── │ opam switch create 5.3.0~rc1+flambda+nffa ocaml-variants.5.3.0~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array └──── All available options can be listed with `opam search ocaml-option'. Changes since the second beta ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ◊ Type system • [#13690]: some type expressions were incorrectly not generalized (because they were assigned to the wrong level pool) [#13690] ◊ Documentation • [#13666]: Rewrite parts of the example code around nested lists in Chapter 6 (Polymorphism and its limitations -> Polymorphic recursion) giving the "depth" function [in the non-polymorphically-recursive part of the example] a much more sensible behavior; also fix a typo and some formatting. (Frank Steffahn, review by Florian Angeletti) [#13666] ◊ Compiler user-interface and warnings: • [#12084], +[#13669], +[#13673]: Check link order when creating archive and when using ocamlopt. [#12084] [#13669] [#13673] Pragmatic Category Theory | Part 3: Associativity ═════════════════════════════════════════════════ Archive: Dmitrii Kovanikov announced ─────────────────────────── Hi everyone! :wave: I've finished writing the third part of my *Pragmatic Category Theory* series (some code examples are in OCaml): • [Part 3: Associativity] Previous discussion: • P.S. I would've edited the previous topic instead of creating a new one but looks like I haven't touched it for a while, so I can't edit the title and the body anymore. [Part 3: Associativity] ocaml-stk, xtmpl, stog, ocaml-css, ocaml-ldp, higlo and chamo ═════════════════════════════════════════════════════════════ Archive: Zoggy announced ─────────────── Hello, I made new releases for some libraries and tools. All are available in opam. [OCaml-stk] 0.4.0 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ OCaml-stk is a library to build graphical user interfaces, based on SDL2. This release includes two new widgets: • a [layers] widget, allowing to display widgets in… layers, • a xmlview widget (in [stk_xml] package), allowing to display XML (and so XHTML) documents, handling CSS for styling and layout. The programmer can customize which widgets are created for each XML node, and add event handlers on each node. See the "xmlview" example included in sources. This new release also comes with an [inspection window] for easier debugging. Complete list of changes is [here]. [OCaml-stk] [layers] [stk_xml] [inspection window] [here] [Xtmpl] 1.0.0 ╌╌╌╌╌╌╌╌╌╌╌╌╌ Xtmpl is a library to build, read and parse XML document. It provides a [rewriting engine] and [templating facilities]. This new release includes a big refactoring, using functors. This creates some incompatibilities with prior versions. See [here] for changes. [Xtmpl] [rewriting engine] [templating facilities] [here] [Stog] 1.1.0 ╌╌╌╌╌╌╌╌╌╌╌╌ Stog is a static web site compiler. It is able to handle blog posts as well as regular pages or any XML document in general. This release upgrades to Xtmpl 1.1.0 and includes small fixes (see [here] for details). [Stog] [here] [OCaml-css] 0.3.0 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ OCaml-css is an OCaml library to parse and print CSS. It can also expand namespaces and perform computations on property values. Parser can be extended by defining additional properties. This release includes various parsing fixes and adds new CSS properties: `border-collapse', `border-spacing', and `opacity'. The complete list of changes is [here]. [OCaml-css] [here] [OCaml-ldp] 0.4.0 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ This is a library to build [LDP] (Linked Data Platform) and [SOLID] applications, runnable either in standalone program (using packages `ldp_tls' or `ldp_curl') or in the browser (using package `ldp_js' with js_of_ocaml). This release includes only one fix in [`Ldp.Http'] module: when following redirection, resolve IRI in Location field of response against original IRI. [OCaml-ldp] [LDP] [SOLID] [`Ldp.Http'] [Higlo] 0.10.0 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌ Higlo is an OCaml library for syntax highlighting. This release adds a simple commonmark lexer. [Higlo] [Chamo] 4.2.0 ╌╌╌╌╌╌╌╌╌╌╌╌╌ Chamo is a source code editor, even if it can be used to edit any text file. A system of "views" allows to edit some kinds of files in specific views. It's like an Emacs where Lisp is replaced by OCaml, as it can be extended and customized in OCaml. This release is just an upgrade to Stk 0.4.0 and Xtmpl 1.0.0. [Chamo] MirageOS on OCaml 5 ═══════════════════ Archive: shym announced ────────────── On behalf of all the numerous developers involved, it’s my pleasure to announce that the MirageOS ecosystem has seen the long-running work to port to OCaml 5 come to fruition: `ocaml-solo5' v1.0 is now using OCaml 5.2.1! What is `ocaml-solo5' ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ `ocaml-solo5' is an OCaml cross compiler for producing Solo5 unikernels. Solo5 is the basis for MirageOS unikernels when they are not compiled as programs to run on a regular OS. `ocaml-solo5' responds to specific unikernel constraints. In particular it provides a placeholder for the standard C library that is complete enough that we can build the OCaml runtime without a full POSIX system to support it. That OCaml runtime can then be linked statically to OCaml programs in order to produce unikernels. These constraints require us to keep track of developments of the OCaml compiler and particularly of its runtime. The major changes coming with OCaml 5 have required quite a lot of work (over 1 year) to bring our cross compiler up-to-date. It should be noted that `ocaml-solo5' is restricted to a single domain but it makes it possible to use the effects introduced with OCaml 5. MirageOS & OCaml 5 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ The long road to bring Mirage on OCaml 5 started with adding support for Thread-Local Storage (TLS) in Solo5. Even if Solo5 doesn’t support the creation of threads, the OCaml 5 runtime stores domain-specific data, including for the first domain, in TLS. The main work was done in [solo5#546] and [solo5#542] with fixes in [solo5#551] and [solo5#554]. It was released with [Solo5 v0.8.0]. This foundational work on Solo5 unblocked the port of the compiler _per se_. As the OCaml runtime changed substantially between OCaml 4.x and 5.x, this required many changes in the minimal library, called `nolibc', that provides simple implementations and stubs for the part of the libc interface the runtime uses. In particular, the memory management of the runtime is very different from OCaml 4.x (which is natural, due to the multicore support): it uses the `mmap~/~munmap' functions instead of `malloc~/~free'. `mmap' is a very versatile interface, tightly tied to the virtual memory. Providing adequate (correct but still simple) implementations of `mmap~/~munmap' in the context of Solo5, _i.e._ without virtualisation of the memory, required a careful review of how the interface is actually used in the runtime. Besides that work on `nolibc', building an OCaml compiler targeting Solo5 also requires a few patches to the compiler build system. As much work has been happening upstream to fix issues in building a cross compiler, this was taken as an opportunity to write clean patches in order to contribute them upstream and simplify the future of OCaml/Solo5 (along with other cross-compiler projects). All this work has been combined in [ocaml-solo5#134], which built on and completed [ocaml-solo5#122], [ocaml-solo5#124] and [ocaml-solo5#129]. It was released in [ocaml-solo5 v1.0.0]. Now we are eager to learn how it behaves in your applications! Note in particular that, as already mentioned, the garbage collector is completely different from the one in OCaml 4. For example, the [Mirage website] currently runs the two versions, one on OCaml 4 and one on OCaml 5 with traffic being alternatively routed to one or the other, to monitor their behaviours. First experiments show that we must tweak the `space_overhead' parameter to have the OCaml 5 unikernel use the same amount of memory than the OCaml 4 one, at the price of some compute time. This generally means that you might have to experiment a bit if you run within very constrained memory limits. [solo5#546] [solo5#542] [solo5#551] [solo5#554] [Solo5 v0.8.0] [ocaml-solo5#134] [ocaml-solo5#122] [ocaml-solo5#124] [ocaml-solo5#129] [ocaml-solo5 v1.0.0] [Mirage website] How to give it a spin ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ To try the new OCaml 5, first create an OPAM switch [with OCaml 5.2.1]. Then, follow the standard procedure (see how to [install it] and how to [build an hello-world unikernel]). After installing `ocaml-solo5', you can check with `opam list ocaml-solo5' that it installed the version `1.x' of the package. [with OCaml 5.2.1] [install it] [build an hello-world unikernel] People involved ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ Many people got involved at some point or another, either with code or comments, to that community effort (hopefully not forgetting anyone, in `sort' order): • Adam Steen • Adrian-Ken Rueegsegger • Christiano Haesbaert • Fabrice Buoro • Hannes Mehnert • Kate • Pierre Alain • Romain Calascibetta • Samuel Hym • Sébastien Hinderer Dune dev meeting ════════════════ Archive: Etienne Marais announced ──────────────────────── Hi camelers! :camel: The next Dune meeting is supposed to be on Wednesday, December, 25th, but since it is Christmas Day (a bank holiday for various countries), the meeting is cancelled. Next one will be on the January, 8th, 2025 :fireworks: Other OCaml News ════════════════ >From the ocaml.org blog ─────────────────────── Here are links from many OCaml blogs aggregated at [the ocaml.org blog]. • [Pragmatic Category Theory | Part 3: Associativity] • [Learn OCaml the Easy Way - Including the Hard Bits] • [MetAcsl v0.8 for Frama-C 30.0 Zinc] • [Saturn 1.0: Data structures for OCaml Multicore] • [Frama-Clang v0.0.17 for Frama-C 30.0~ Zinc] [the ocaml.org blog] [Pragmatic Category Theory | Part 3: Associativity] [Learn OCaml the Easy Way - Including the Hard Bits] [MetAcsl v0.8 for Frama-C 30.0 Zinc] [Saturn 1.0: Data structures for OCaml Multicore] [Frama-Clang v0.0.17 for Frama-C 30.0~ Zinc] 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]