OCaml Weekly News
Hello
Here is the latest OCaml Weekly News, for the week of July 30 to August 06, 2024.
Table of Contents
Ppxlib dev meetings
Continuing this thread, Patrick Ferris announced
Meeting notes are available here: https://github.com/ocaml-ppx/ppxlib/wiki/Dev-Meeting-2024-07-23
Thank you to all of the participants. If anyone is interested in adding items for the next meeting in August do ping me.
Until then happy ppx-ing :))
Pragmatic Category Theory
Dmitrii Kovanikov announced
I started writing a series on Pragmatic Category Theory for Beginners focusing on real-world use cases rather than theory. All code examples are in OCaml.
The first part was just finished:
It's just the beginning, and I have plans to describe more and provide more examples in future parts. I also plan to make a video version as well.
I hope you'll enjoy it!
ppxlib.0.33.0
Nathan Rebours announced
The Ppxlib dev team is happy to announce the release of ppxlib.0.33.0
.
You can find the full changelog for this release here.
Warning silencing for [@@deriving ..]
generated code
This release's main feature is a series of improvement to flags controlling unused value/module/type warnings silencing.
The ppxlib
driver generates warning silencing items to prevent [@@deriving ...]
generated code to trigger unused code warnings. Three warnings are disabled that
way:
- Warning 32: unused value
- Warning 60: unused module
- Warning 34: unused type
The first two are disabled for values and modules generated by the deriver while the third is disabled for the types in the type declaration to which the [@@deriving ...]
attribute is attached.
This feature was added a long time ago to avoid manually disabling those warnings when working with derivers that generate a set of values and modules only to use a subset of those. Alternatively, the unused type warning silencing was added to allow defining an alias type only to be consumed by a deriver, e.g.:
type error = [`Not_found | `Invalid_arg] [@@deriving to_string]
We since then believe that we should not disable warnings lightly, as this behaviour makes it difficult to find and remove dead code. The right approach in those situations should be to fix the PPX derivers so that they are more configurable and can be used without triggering such warnings.
We will start to move toward removing this feature, but since it is still useful in some places, we had to come up with a plan to allow transitioning out of it.
In ppxlib.0.31.0
we added the -unused-code-warnings
driver flag and the
?unused_code_warnings
's Deriving.V2.make
optional argument to control whether to silence Warnings 32 and 60. When both are set to true
, by the user and the deriver authors, the warnings are not silenced.
As of ppxlib.0.33.0
, these also control the silencing of Warning 34 (unused type). force
can now be passed to the -unused-code-warnings
flag in order to disable warnings silencing, regardless of the derivers opting in.
This allows users to test whether their codebase and their set of derivers rely on warning silencing or not and to use those results to eliminate dead code and/or report issues upstream to the derivers they use.
We also added a separate -unused-type-warnings
flag that works similarly to
-unused-code-warnings
(i.e., depends on the value of the ?unused_code_warnings
argument), but it only controls Warning 34 silencing, as it turns out it is less likely to cause unwanted warnings than with the other two. This will allow users to disable it more easily, without having to deal with Warnings 32 and 60 straight away.
We want to encourage users to try those on their codebase in order to see the impact it has. Did you have dead code lying around that slipped past undetected? Does this trigger unwanted warnings because of deriver's generated code?
The plan is to give the ecosystem some time to try those features and adapt by fixing individual derivers and flipping ?unused_code_warnings
to true as they do. After a while, we will swap the default value of the driver flag to true
so that only derivers that haven't opted in will enable warning silencing. Then as time goes we will swap the default of the Deriving.make
argument so that derivers will instead have to explicitly opt out to get the warning silencing. Finally, once we are confident the ecosystem is in a good enough state, we will remove this feature altogether.
Other features
ppxlib.0.33.0
also comes with a couple of new features for PPX authors:
- A couple new
Ast_builder
functions:elist_tail
andplist_tail
that can be used to build list expressions and patterns with a custom tail:elist_tail [expr1; expr2] tail_expr
returns the expression forexpr1::expr2::tail_expr
. Context_free.special_function'
, a new version ofspecial_function
that allows passing aLongident.t
directly rather that relying on parsing the string argument to aLongident.t
.
Finally, the release includes a few bug fixes to Longident.parse
and
Code_path.main_module_name
and fixes the location-check
flag so it is not
required to also pass -check
to enable location checks. It also fixes the 5.2
migrations locations, as we used to build nodes with inconsistent locations when
migrating Pexp_function
nodes.
Huge thanks to our external contributors
We would like to thank our external contributors who have been a huge part of this release: @octachron, @vg-b, and @jchavarri, and a special mention to @mbarbin, who has not only contributed a lot to the warning silencing features but has been extensively testing and providing very useful feedback on them.
And of course, as usual, we'd like to thank the OCaml Software Foundation who has been funding my work on Ppxlib and on this release, making all of this possible!
OCaml-LSP 1.19.0 for OCaml 5.2
vds announced
I am happy to announce, on behalf of the ocaml-lsp team, the release of ocaml-lsp-server
1.19.0
and associated libraries. This release primary goal is to bring official support for OCaml 5.2 🐫.
Features
- Add custom [~ocamllsp/getDocumentation~](/ocaml-lsp-server/docs/ocamllsp/getDocumentation-spec.md) request (ocaml/ocaml-lsp#1336)
- Add support for OCaml 5.2 (ocaml/ocaml-lsp#1233)
Fixes
- Kill unnecessary ocamlformat processes with sigterm rather than sigint or sigkill (ocaml/ocaml-lsp#1343)
MlFront - A packaging system for OCaml
jbeckford announced
Here are the introductory paragraphs from its overview:
MlFront
adds a Java-like packaging system to OCaml. TheMlFront
name is a homage tocfront
which was tooling that translated "C with Classes" (now known as C++) into C code. Similarly,MlFront
-based tools can translate OCaml with packages into conventional OCaml. … At its most basic core,MlFront
gives a well-defined, consistent meaning to a module reference likeAcmeWidgets_Std.Activities.Manufacturing
across the domains of:
- OCaml source code.
- findlib libraries.
- opam packages.
MlFront
is Apache 2.0 licensed and is meant to be used by build systems (Dune, ocamlbuild, DkCoder) and package managers (opam). One of its critical dependencies is codept.
You can read more about MlFront
in the following posts (with more coming):
Cross-post notice: The first article was posted at https://lobste.rs/s/7ghslo/overview_ocamlfront; no comments (:(). But I still like to get first-hand feedback on what works well in other languages, so please chime in even if you don't feel that OCaml is your strong suit.
OCaml.org Newsletter: July 2024
Sabine Schmaltz announced
Welcome to the July 2024 edition of the OCaml.org newsletter! This update has been compiled by the OCaml.org maintainers. You can find previous updates on Discuss.
Our goal is to make OCaml.org the best resource for anyone who wants to get started and be productive in OCaml. The OCaml.org newsletter provides an update on our progress towards that goal and an overview of the changes we are working on.
We couldn't do it without all the amazing people who help us review, revise, and create better OCaml documentation and work on issues. Your participation enables us to so much more than we could just by ourselves. Thank you!
This newsletter covers:
- Community-Driven Development of OCaml.org
- Recipes for the OCaml Cookbook: Help us make the OCaml Cookbook really useful by contributing and reviewing recipes for common tasks!
- Community & Marketing Pages Rework: Implementation work in progress.
- General Improvements: As usual, we also worked on general maintenance and improvements, so we're highlighting some of the work that happened below.
Community-Driven Development of OCaml.org
After reworking most of the OCaml.org website to be more useful, more usable, and nicer to look at, the team at Tarides that has been working on OCaml.org is disbanding. However, OCaml.org will continue to be maintained and extended by by the OCaml Platform and OCaml compiler contributors, as well as by the wider OCaml community.
You can reach out to the OCaml.org maintainers to discuss any bigger changes or additions you'd like to make. Contributions to improve existing features and bug fixes are always welcome!
- Open Issues for Contributors
You can find open issues for contributors here!
Recipes for the OCaml Cookbook
The OCaml Cookbook is a place where OCaml developers share how to solve common tasks using packages from the ecosystem.
A recipe is a code sample and explanations on how to perform a task using a combination of open-source libraries.
The Cookbook is live at ocaml.org/cookbook.
Here's how you can help:
- Help review the open pull requests for cookbook recipes!
- Contribute new recipes and tasks for the cookbook!
Thank you all for the many contributions! One area where we could use help is in reviewing and improving the suggested recipes and tasks.
Relevant PRs and Activities:
- (open) PR: cookbook recipes for parse-command-line-arguments ocaml/ocaml.org#2573 by @richardhuxton
- (open) PR: Cookbook Check a Webpage for Broken Links ocaml/ocaml.org#2581 by @ggsmith842
- (open) PR: cookbook: "create and await promises": Lwt, Async ocaml/ocaml.org#2584 by @richardhuxton
- (open) PR: CookBook: read-csv - basic example of reading records from a CSV string ocaml/ocaml.org#2589 by @danielclarke
- (open) PR: Cookbook: Email regex patch ocaml/ocaml.org#2591 by @F-Loyer
- Fixes and Improvements to existing recipes:
- PR: Update 00-uri.ml: missing arg ocaml/ocaml.org#2618 by @ttamttam
Community & Marketing Pages Rework
We have UI designs for the reworked and new pages of the community section, and implementation is being worked on by @oyenuga17, our former Outreachy intern!
Relevant PRs and Activities:
- PR: Implement new community overview page ocaml/ocaml.org#2605 by @oyenuga17
- PR: Fix typo and case inconsistencies on community page ocaml/ocaml.org#2616 by @pjlast
- PR: Redesign OCaml Planet Page ocaml/ocaml.org#2617 by @oyenuga17
General Improvements and Data Additions
Summary:
- The selected OS is now part of the anchor tag of the URL on the https://ocaml.org/install page. This allows people to link to quick install instructions for a specific OS.
- We appreciate the contributions to the OCaml documentation!
- We're checking for backlinks to OCaml.org again with Ahrefs.
Relevant PRs and Activities:
- (open) PR: Build on OCaml 5 (ocamlnet -safe-string workaround) ocaml/ocaml.org#2609 by @aantron
- PR: Ahref tag ocaml/ocaml.org#2571 by @cuihtlauac
- PR: Issue #2583: Added OS Anchor Tags to ocaml.org/install ocaml/ocaml.org#2600 by @SisyphianLiger
- PR: Performance: cache search index digest until ocaml-docs-ci computes it ocaml/ocaml.org#2620 by @sabine
- Documentation
- PR: Unwrapped libraries ocaml/ocaml.org#2562 by @cuihtlauac
- PR: Explain folders bin, lib and _build ocaml/ocaml.org#2568 by @cuihtlauac
- PR: Use
layout opam
in.envrc
in opam path doc ocaml/ocaml.org#2597 by @smorimoto - PR: Use sudo in install tutorial ocaml/ocaml.org#2558 by @cuihtlauac
- PR: Add documentation about comments to Tour of Ocaml ocaml/ocaml.org#2613 by @NoahTheDuke
- PR: Fix Example referencing Type not yet Defined ocaml/ocaml.org#2606 by @avlec
- Refactor + Code health:
- PR: Open Data_intf in data.mli ocaml/ocaml.org#2563 by @cuihtlauac
- PR: Make data error file path copy-paste ready ocaml/ocaml.org#2567 by @cuihtlauac
- PR: Test ocaml/setup-ocaml v3 ocaml/ocaml.org#2570 by @cuihtlauac
- PR: Update ocaml/setup-ocaml to v3 ocaml/ocaml.org#2565 by @smorimoto
- PR: Refactoring parts from PR #2443 ocaml/ocaml.org#2576 by @cuihtlauac
- PR: Bump peter-evans/create-pull-request from 5 to 6 ocaml/ocaml.org#2588 by @dependabot
- PR: Set OCaml to 4.14.2 ocaml/ocaml.org#2587 by @cuihtlauac
- PR: fix: write directory instead of folder ocaml/ocaml.org#2572 by @ashish0kumar
- PR: sync debug-ci and ci ocaml/ocaml.org#2582 by @cuihtlauac
- Data
- PR: changelog: dune 3.16.0 ocaml/ocaml.org#2566 by @emillon
- PR: (data) add OCaml.org newsletter June 2024 ocaml/ocaml.org#2575 by @sabine
- PR: Add changelog for the latest merlin releases ocaml/ocaml.org#2580 by @voodoos
- PR: Add changelog for the latest ocaml-lsp release ocaml/ocaml.org#2593 by @PizieDust
- PR: Add missing changelog for opam 2.2.0 ocaml/ocaml.org#2598 by @kit-ty-kate
- PR: Add changelog entry for ppxlib.0.33.0 release ocaml/ocaml.org#2615 by @NathanReb
Other OCaml News
From 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.