OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of May 28 to June 04, 2024.

Table of Contents

v0.17 release of Jane Street packages

Diana Kalinichenko announced

v0.17 release of Jane Street packages

Dear OCaml developers,

We are pleased to announce the v0.17 release of Jane Street packages!

This release comes with 15 new packages and a multitude of new features and fixes.

Switch to OCaml 5.1

We are switching Base and all our packages (except sexplib0) to OCaml 5.1 and above. We are also switching sexplib0 to 4.14 to take advantage of the Tail Recursion Modulo Cons optimization in the compiler.

Core on OCaml 5.2

Due to some changes to Stdlib.Gc in OCaml 5.2, core.v0.17.0 fails to compile with that language version. We will release a fix that allows using Core with OCaml 5.2 soon.

Torch and VCaml

Due to some issues with their builds, torch.v0.17.0 and vcaml.v0.17.0 were omitted from the main v0.17 release. We will soon submit those packages to opam.

Changes

Browse our GitHub repositories and look at the respective CHANGES.md files for changes since the v0.16 release. For examples, see changelogs for Base, Async_kernel, and Bonsai.

New packages

async_log – a logging library for Async code, moved from async_unix

capitalization – a library for case conventions and renaming identifiers

codicons – icons from VS Code for use with Bonsai

gel – a library to mark non-record fields global for use with our compiler extensions

hardcaml_event_driven_sim – a simulator library for Hardcaml

ocaml_intrinsics_kernel – a split from ocaml_intrinsics compatible with javascript

ocaml_openapi_generator – an OpenAPI 3 to OCaml client generator

ppx_diff – a ppx for generation of diffs and update functions for OCaml types.

ppx_embed_file – a ppx that allows embedding files directly into executables/libraries as strings or bytes

ppxlib_jane – utilities for working with Jane Street AST constructs

ppx_quick_test – a ppx providing an ergonomic wrapper for quickcheck tests, similar to ppx_inline_test

ppx_string_conv – deriving to_string~and ~of_string

uopt – unsafe option type that does not allocate, moved from core_kernel

versioned_polling_state_rpc – helper functions for versioned Polling_state_rpc.t

virtual_dom_toplayer – bindings for the floating_positioning javascript library

jsonschema2atd, Generate an ATD file from a JSON Schema / OpenAPI document

Louis RochΓ© announced

Ahrefs has released jsonschema2atd, a cli tool to convert an OpenAPI or Json Schema specification into an atd file.

Quite a lot of api out there are now publishing some kind of spec for their expected input our output. It's often done through a a JSON Schema or OpenAPI document. The goal of this tool is to save time for large api by doing a mechanical translation to an atd file instead of writing all the types by hand.

Unfortunately the world is kind of a mess. Most of the specs we have seen are not following a specific version of openapi/jsonschema but contain a bit of everything. jsonschema2atd does its best to do the right thing, but there are probably cases that aren't covered.

The generated code might also not be optimal. It often deserves some hand cleanup and a bit of renaming. Hopefully it still gives a good head start.

Thanks to Egor Chemokhonenko for this work.

The code is available at https://github.com/ahrefs/jsonschema2atd

And there is a package that is published on opam https://ocaml.org/p/jsonschema2atd/latest

opam-repository policy change: checksums (no md5) and no extra-files

Hannes Mehnert announced

Dear everyone,

the opam-repository policy just changed to not accept md5-only checksums, and also to avoid extra-files in packages (use extra-source instead).

NOTE:

If you encounter issues during opam update, please make sure to have opam 2.1.6 installed, and gpatch (especially on BSD systems and macOS). This may break silently, if you encounter issues, please rm -rf ~/.opam/repo/default && opam update default See further notes in https://github.com/ocaml/opam-repository/issues/25961

What has been achieved?

These changes were automated using opam admin migrate-extrafiles and opam admin add-hashes (using the branch https://github.com/hannesm/opam/tree/migrate-extra-files). There is a utility to check that existing files and md5 checksums are still present in the new opam-repository https://github.com/hannesm/opam-check-checksum.

Impact on users and developers

  • A lot of packages will want to be recompiled on opam upgrade (since checksum changed, extra-files/extra-source was modified) – sorry for the extensive use of CPU time
  • If you need to include a patch or an extra file for your opam package, you will need to host it elsewhere. You can host it using a gist (https://gist.github.com), or on your server. All the extra-source will be cached by opam.ocaml.org.

The reasoning for this change

Apart from making the mental model of "how does opam-repository work" easier (since there's no more any files subdirectory which includes files that are added during the build), it also makes the approach to cryptographically sign the repository much smoother (since we can now rely on non-weak hash algorithms and don't need to compute more hashes, and not need to add further hashes to the repository).

We needed to get both (weak hashes AND removing extra-files) through at some point, it has been done today.

Camlkit – macOS/iOS/GNUstep toolkit for OCaml

borisd announced

I am pleased to announce the alpha release of Camlkit. Camlkit provides OCaml bindings to a collection of Cocoa frameworks on macOS, iOS, and GNUstep. Currently available are Foundation, AppKit, UIKit, WebKit, CoreImage, Photos, and Vision.

The package camlkit for macOS/GNUstep development is available from OPAM. The key libraries to add to your dune file are camlkit-base.foundation and camlkit-gui.appkit.

iOS development requires a cross-toolchain. The package is named camlkit-ios. UIKit is in the library camlkit-gui.uikit.

Other useful resources:

More information is available on the project's github page. Feedback and contributions are welcome. I hope we can make OCaml viable for GUI development and on mobile. Happy hacking!

position for MoonBit advocate

Hongbo Zhang announced

MoonBit is ML language inspired by Rust, Go and OCaml, it was announced with a Wasm backend, and recently we added a JavaScript backend, we plan to ship a native backend this year.

It is similar to OCaml, the main difference is that we have traits, zero-cost generics and modern tooling support. You are welcome to DM for more details.

Why is there no tradition of CLI and TUI apps?

Deep in this thread, Jazz announced

I once created a command-line bookmarking tool called Favemarks in OCaml using Janestreet's Core Command.

Ppxlib dev meetings

Continuing this thread, Patrick Ferris announced

The meeting notes are now available from the last meeting.

Thanks to everyone who attended the meeting. The next meeting is set for [date=2024-06-18 time=17:00:00 timezone="Europe/London"], if that changes we'll post to this thread. Hope to see you there!

Yojson 2.2.0

Marek Kubica announced

Hello fellow Camel-wranglers,

It's my pleasure to announce the release of Yojson 2.2.0 which you can find in your neighborhood opam-repository.

The most important highlights include:

  • JSON5 support. Getting annoyed by dangling commas being a problem or the inability to use comments? JSON5 is basically JSON but with the object syntax of ECMAScript 5.1 which allows some additional features like unquoted keys, dangling commas or well, comments. This has been in the works for years but finally made it to the finish-line. The new JSON5 parser requires sedlex and at least OCaml 4.08, thus it is part of the yojson-five package. Its usage mimics the Yojson package; there exist both Basic and Safe variants and the AST matches the JSON variants.
  • No CPPO dependency anymore. Given the large amount of reverse-dependencies on Yojson, each dependency of Yojson is going to be a dependency of a lot of packages, thus keeping the dependency cone small makes everything (slightly) faster. As such, instead of using CPPO as a compile-time dependency we now use Β΅CPPO as a light-weight alternative. Β΅CPPO is meant for embedding as part of the build process and supports a tiny subset of what CPPO supports but without an extra package.

Happy de- and encoding!

Grace 0.2.0 πŸ’…, fancy diagnostics library for compilers

"Alistair O'Brien announced

I'm excited to announce the release of grace 0.2.0, an OCaml library for building, reporting and rendering beautiful compiler diagnostics :camel: :paintbrush:. Now available on opam-repository.

The three main features of this release include:

  • :books: UTF8 support: Source files can now contain Unicode characters, including emojis ⚑️ 🌈 πŸš€, with proper rendering of ASCII art for errors.
  • :1234: Error Codes: Diagnostics can now include short, searchable error codes. Allowing compilers to integrate a Rust-like error code index.
  • 🀏 Compact ANSI Errors: Grace_ansi_renderer now supports a pp_compact_diagnostic for concise error messages, displaying only the file location and the error message.

31ba975d2cf17966eb4533c1f6ba441731686d0d.png

Tap into the power of Grace for your error reporting! Happy hacking πŸ‘¨β€πŸ’»

CHANGES:

  • fix(renderer): remove uncessary underlines when printing a unique 'multi-line Top marker' (#31)
  • fix(renderer): replace unicode chars with ASCII in Config.ascii (#27)
  • feat(renderer): add NO_COLOR and TERM support to Config (#8)
  • feat(core,renderer): add support for error codes (#30)
  • feat(renderer): add support for UTF8 encoding (#25)
  • feat(renderer): re-introduce support for compact diagnostic rendering (#28)
  • refactor(renderer)!: move grace.renderer library to grace.ansi_renderer (#29)

BREAKING CHANGE

  • Grace_rendering has been removed. Use Grace_ansi_renderer instead.

First release of Slipshow on opam!

Paul-Elliot announced

It is my pleasure to announce the first release of slipshow on opam.

Slipshow is a presentation tool to create presentation that are not based on slides, but on more continuous transitions, similar to scrolling.

slip_scroll.gif

You can find more information and examples on the project repo and on the documentation.

How is that related to the OCaml community? While the "runtime"/"engine" is still written in javascript (I did not know OCaml back then, but there is a plan to rewrite it), the compiler is written in OCaml! And I am really grateful for the many authors of open source libraries, of very high quality, that I depend on and could do nothing without them :) Thanks a lot to all OCaml library and tool authors!

$ opam update
$ opam install slipshow
# create and open ~source.md~ in your editor
$ slipshow --serve source.md

Hope it can be useful :D

Other OCaml News

From the ocaml.org blog

Here are links from many OCaml blogs aggregated at the ocaml.org blog.

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.