Hello Here is the latest OCaml Weekly News, for the week of January 26 to February 02, 2021. Table of Contents ───────────────── release 0.2.2 of ppx_deriving_encoding OCaml 4.12.0, second beta release OCaml Office Hours? Timere 0.1.3 - Dealing with time and time zones have never been easier Interesting OCaml Articles json-data-encoding 0.9 ocamlearlybird 1.0.0 beta1 Cmdliner cheatsheet containers 3.2 OCaml Café: Thu, Feb 11 @ 7pm (U.S. Central) Dependency graph of some OCaml source files Other OCaml News Old CWN release 0.2.2 of ppx_deriving_encoding ══════════════════════════════════════ Archive: levillain.maxime announced ────────────────────────── Following the release of [json-data-encoding.0.9], I am happy to announce the release of ppx_deriving_encoding.0.2.2. The code source and some documentation is available on [gitlab], and the package can be installed with opam (`opam install ppx_deriving_encoding'). This ppx allows to derive encoding of json-data-encoding library from most of ocaml types. Have fun! [json-data-encoding.0.9] [gitlab] OCaml 4.12.0, second beta release ═════════════════════════════════ Archive: octachron announced ─────────────────── The release of OCaml 4.12.0 is on the horizon. We have created a new beta version to help you adapt your software to the new features ahead of the release. Compared to the first beta release, this new release contains one fix for the Thread library (for a race condition on Windows), and experimentally re-enables building the compiler on illumos and Oracle Solaris. We are expecting this beta to be the last one before the release. If you find any bugs, please report them here: Happy hacking, – Florian Angeletti for the OCaml team. Installation instructions ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ The base compiler can be installed as an opam switch with the following commands ┌──── │ opam update │ opam switch create 4.12.0~beta2 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git └──── If you want to tweak the configuration of the compiler, you can pick configuration options with ┌──── │ opam update │ opam switch create --packages=ocaml-variants.4.12.0~beta2+options, │ --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git └──── where is a comma separated list of ocaml-option-* packages. For instance, for a flambda and afl enabled switch: ┌──── │ opam switch create 4.12.0~beta2+flambda+afl │ --packages=ocaml-variants.4.12.0~beta2+options,ocaml-option-flambda,ocaml-option-afl │ --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git └──── All available options can be listed with "opam search ocaml-option". The source code is available at these addresses: • If you want to test this version, you may want to install the alpha opam repository with ┌──── │ opam repo add alpha git://github.com/kit-ty-kate/opam-alpha-repository.git └──── This alpha repository contains various packages patched with fixes in the process of being upstreamed. Once the repository installed, these patched packages will take precedence over the non-patched version. Changes from the first beta ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ Thread library ┄┄┄┄┄┄┄┄┄┄┄┄┄┄ • *additional fixes* [9757], [9846], +[10161]: check proper ownership when operating over mutexes. Now, unlocking a mutex held by another thread or not locked at all reliably raises a Sys_error exception. Before, it was undefined behavior, but the documentation did not say so. Likewise, locking a mutex already locked by the current thread reliably raises a Sys_error exception. Before, it could deadlock or succeed (and do recursive locking), depending on the OS. (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by Guillaume Munch-Maccagnoni, David Allsopp, and Stephen Dolan) [9757] [9846] [10161] Build system ┄┄┄┄┄┄┄┄┄┄┄┄ • [10063]: (Re-)enable building on illumos (SmartOS, OmniOS, …) and Oracle Solaris; x86_64/GCC and 64-bit SPARC/Sun PRO C compilers. (partially revert [2024]). (Tõivo Leedjärv and Konstantin Romanov, review by Gabriel Scherer, Sébastien Hinderer and Xavier Leroy) [10063] [2024] Documentation ┄┄┄┄┄┄┄┄┄┄┄┄┄ • [9755]: Manual: post-processing the html generated by ocamldoc and hevea. Improvements on design and navigation, including a mobile version, and a quick-search functionality for the API. (San Vũ Ngọc, review by David Allsopp and Florian Angeletti) • [10142], [10154]: improved rendering and latex code for toplevel code examples. (Florian Angeletti, report by John Whitington, review by Gabriel Scherer) [9755] [10142] [10154] OCaml Office Hours? ═══════════════════ Archive: Deep in this thread, Orbifx said ──────────────────────────────── And there is XMPP: Timere 0.1.3 - Dealing with time and time zones have never been easier ══════════════════════════════════════════════════════════════════════ Archive: Darren announced ──────────────── I am happy to announce first release of [Timere], a time handling and reasoning library, which @Drup and I have been working on recently. [Timere] Examples ╌╌╌╌╌╌╌╌ Christmases which fall on Wednesday from now ┌──── │ let () = │ let open Timere in │ match │ resolve ( │ after (Date_time.now ()) │ & months [`Dec] │ & days [25] │ & weekdays [`Wed] │ ) │ with │ | Error msg -> failwith msg │ | Ok s -> │ Fmt.pr "%a@." (pp_intervals ~sep:(Fmt.any "@.") ()) s └──── gives ┌──── │ [2024 Dec 25 00:00:00 +00:00:00, 2024 Dec 26 00:00:00 +00:00:00) │ [2030 Dec 25 00:00:00 +00:00:00, 2030 Dec 26 00:00:00 +00:00:00) │ [2041 Dec 25 00:00:00 +00:00:00, 2041 Dec 26 00:00:00 +00:00:00) │ [2047 Dec 25 00:00:00 +00:00:00, 2047 Dec 26 00:00:00 +00:00:00) │ [2052 Dec 25 00:00:00 +00:00:00, 2052 Dec 26 00:00:00 +00:00:00) │ [2058 Dec 25 00:00:00 +00:00:00, 2058 Dec 26 00:00:00 +00:00:00) │ ... └──── See [here] for more examples [here] Features ╌╌╌╌╌╌╌╌ • Timestamp and date time handling with platform independent time zone support • Subset of the IANA time zone database is built into this library • Reasoning over time intervals via timere objects/expressions, examples: • Pattern matching time and intervals. These work across DST boundaries. • Intersection and union • Chunking at year or month boundary, or in fixed sizes • Evaluate (sub)expressions with a different time zone (e.g. intersection of 9am to 5pm of Sydney and 9am to 5pm of New York) Links ╌╌╌╌╌ • Repo: • API doc: Interesting OCaml Articles ══════════════════════════ Archive: Yawar Amin announced ──────────────────── Not primarily a programming article but I thought this is an interesting exception because it may be the first time OCaml has been mentioned in the Financial Times: json-data-encoding 0.9 ══════════════════════ Archive: Raphaël Proust announced ──────────────────────── On behalf of Nomadic Labs, it is my pleasure to release json-data-encoding.0.9.1. The code of this packaging-fix release is identical to the recent json-data-encoding.0.9 but the license information has been corrected. The previous release had _LGPL with linking exception_ headers in the source files, LICENSE file in the repository, and license field in the opam file. However, the code was actually under MIT as per agreement of the copyright holders. Release 0.9.1 has the correct license headers, LICENSE file and license field in the opam files. The code of 0.9/0.9.1 is in dual license. Future releases will be under MIT license only. ocamlearlybird 1.0.0 beta1 ══════════════════════════ Archive: 文宇祥 announced ──────────────── I'm pleased to annonce that [ocamlearlybird] 1.0.0~beta1 just released. Will soon be available on opam. This is a big step that we toward 1.0.0. We solved lots of issues and tested with realy ocaml projects such as utop, ocamlformat, and so on. And certainly, it can debug ocamlearlybird itself. Try yourself! [ocamlearlybird] NOTES. ╌╌╌╌╌╌ • New version only support OCaml 4.11. If you need other versions support, please let me know. • Dune-release do not support `1.0.0~beta1' version string. So we released 1.0.0 as 1.0.0~beta1 on opam. KNOWN ISSUES: ╌╌╌╌╌╌╌╌╌╌╌╌╌ • Continue run command may hit on last removed breakpoint once when debug utop. 文宇祥 ────── Since the post has edited over 3 times. I can't edit it anyway. I uploaded demo video here: [Debug utop] [Debug utop] Cmdliner cheatsheet ═══════════════════ Archive: Martin Jambon announced ─────────────────────── As a follow-up to [an earlier conversation], I made a [cheatsheet and a template] for using cmdliner by @dbuenzli. It was done quickly and I don't know everything about cmdliner, so please let me know if you see mistakes. [an earlier conversation] [cheatsheet and a template] Christian Lindig then said ────────────────────────── Good to see this. I believe a common use case is to add are sub commands as popularised by `git'. It looks like this in my code: ┌──── │ module C = Cmdliner │ │ let report = │ let doc = "generate HTML or JSON report for an outing" in │ let man = .. in │ C.Term. │ (ret (const make $ common_options $ json $ path), info "report" ~doc ~man) │ │ let default = │ let help = `Help (`Pager, None) in │ let doc = "GPS analysis for rowers" in │ C.Term.(ret @@ const help, info "eightplus" ~doc ~man) │ │ let cmds = [ export; report; topspeed; debug; summary; help ] │ let main () = C.Term.(eval_choice default cmds |> exit) │ let () = if !Sys.interactive then () else main () └──── Martin Jambon later said ──────────────────────── I just added a demo/template for subcommand handling. There are now [two demo programs]. One is focused on the different kinds of arguments and the other one on subcommands. [two demo programs] Shon also replied ───────────────── In this same vein, I've been compiling "executable notes" whenever I find myself needing a certain Cmdlner recipe. I took took these recent discussion as an occasion to document the module a bit: The aim is to provide "self-documenting" constructors that encode the composition of common CLI terms into module namespaces, labeled args, and type aliases. The hope being that I can have the type signature of a combinator give me all the hints I need to avoid having to look up the documentation every time :laughing: It's just a very rough (and quite imperfect) collection of idioms I've found useful, but it could be worth a look! When i get a chance, I hope to look through your cheat sheet to make sure I have a representative constructor for each idiom you've documented. containers 3.2 ══════════════ Archive: Simon Cruanes announced ─────────────────────── I'm happy to announce that containers 3.2 has just been [released]. It should arrive on opam soon. It notably contains an `Either' compatibility wrapper, more formatting functions, list functions, and a bunch of fixes. Many thanks to @darrenldl for contributing some initial fuzzing support. [released] OCaml Café: Thu, Feb 11 @ 7pm (U.S. Central) ════════════════════════════════════════════ Archive: Claude Jager-Rubinson announced ─────────────────────────────── Join us with your questions about the OCaml language, or just to hang out with the OCaml community. Especially geared toward new and intermediate users, experienced OCaml developers will be available to answer your questions about the language and ecosystem. Whether you’re still trying to make sense of currying or can spot non-tail-recursive code from across the room, we hope that you’ll join us on Thursday, February 11 at 7pm (U.S. Central time). Meeting info and additional details can be found at [https://hfpug.org]. [https://hfpug.org] Dependency graph of some OCaml source files ═══════════════════════════════════════════ Archive: Deep in this thread, Jun FURUSE said ──────────────────────────────────── You may be interested in [cmgraph] which scrapes the compiled modules (`*.cmi/*.cmo/*.cmx') instead of the source code. It needs no compilation switch options since it does not scrape source code. [cmgraph] Other OCaml News ════════════════ From the ocamlcore planet blog ────────────────────────────── Here are links from many OCaml blogs aggregated at [OCaml Planet]. • [Recent and upcoming changes to Merlin] • [The road ahead for MirageOS in 2021] • [Release of Alt-Ergo 2.4.0] [OCaml Planet] [Recent and upcoming changes to Merlin] [The road ahead for MirageOS in 2021] [Release of Alt-Ergo 2.4.0] 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 [online]. [Alan Schmitt] [send me a message] [the archive] [RSS feed of the archives] [online] [Alan Schmitt]