OCaml Weekly News
Hello
Here is the latest OCaml Weekly News, for the week of June 18 to 25, 2024.
Table of Contents
- First public editor tooling dev-meeting
- First release of oma
- Ppxlib dev meetings
- CAISAR release 2.0, a platform for characterizing AI safety and robustness
- First release of baby
- Preview of Stripe client and mock server - DkStdRestApis
- opam 2.2.0 rc1 release
- Project wide occurrences
- Other OCaml News
- Old CWN
First public editor tooling dev-meeting
vds announced
We are organizing the first public dev-meeting about Merlin, OCaml-LSP and more generally editor support for OCaml. This meeting will take place on Thursday, June 27th, at 05:00 pm CEST. We plan to have these happen every last Thursday of the month.
The goal of these meetings is to provide a place for all contributors of these projects to discuss their work together. Whether you are a long time maintainer, an occasional contributor, a new comer, or simply a curious passer-by, please feel free to join and participate!
We also plan to have some short technical presentations to help contributors learn more about the projects involved. These won't be systematic, and if you are interested in a particular subject feel free to ask about it or to propose a presentation.
The agenda for this first meeting, which will be focused on the burning topic of project-wide occurrences, is the following:
- A tour-de-table to allow the participants that wish to do so to present themselves and mention issues / prs they are interested in.
- A presentation of current on-going projects.
- A focus on project-wide occurrences: how does it work, what are the tools that need to interact together and what are its current limitations and possible future improvements.
- Discuss issues and pull requests that were tagged in advance or mentioned during the tour-de-table.
- Informal discussion
We looking forward to meeting you!
Meeting link: https://meet.google.com/imo-mkxi-hpt
First release of oma
François Pottier announced
I have just published a new release of oma
with the following fixes and changes:
- New functions
invalidate_open_interval
andinvalidate_semi_open_interval
. - Fix a serious bug in
Unsafe.first
andUnsafe.last
, which would incorrectly returnNone
when the region contains only one point. - Fix a serious bug in
Unsafe.iter
, which would systematically omit the last point of the region.
Ppxlib dev meetings
Nathan Rebours announced
Meeting notes are available here: https://github.com/ocaml-ppx/ppxlib/wiki/Dev-Meeting-2024-06-18.
Thanks to everyone who attended!
Our next meeting is scheduled for Tuesday July 16th, 6:00PM CET!
CAISAR release 2.0, a platform for characterizing AI safety and robustness
Julien Girard announced
On the occasion of the 34th birthday of the abolition of the apartheid laws, we are honoured to release CAISAR version 2.0.
The release source is available at our public forge. As our last releases, CAISAR will soon be available on opam and on Dockerhub.
A nix flake is available for building CAISAR directly in the repository. Try CAISAR with nix build git+https://git.frama-c.com/pub/caisar
!
Here are the prominent features for this 2.0 release:
Specification and verification of several neural networks at once
CAISAR specification language already allowed to write specifications that involved several neural networks at once. However, translating such specifications to actual prover queries was not possible. We added automated graph editing techniques to allow such verification to take place. Within particular patterns, CAISAR will generate an ONNX file that preserve the semantic of the different neural networks while encapsulating parts of the specification directly in the control flow of the new neural network. This feature allow the verification of properties with multiple neural networks, including their composition.
This is quite a step forward, as it enables machine-learning dedicated verifiers to tackle a much wider range of properties.
SVM as first-class citizens for interpretation
CAISAR now fully integrate SVMs into the interpretation engine. Users can expect vector computations and applications on SVMs to be computed similarly as what exists already for neural networks.
We also unified the theory of machine learning models. Now, SVMs and neural networks can be specified with only the model
type. In the near future, SVMs will be parsed directly into CAISAR’s Neural Intermediate Representations, which will simplify the verification of systems with heterogeneous AI components.
First release of baby
François Pottier announced
It is my pleasure to announce the first release of baby
.
baby
is an OCaml library that offers several implementations of balanced binary search trees. At this time, baby
offers a replacement for OCaml's Set
module; it does not yet have a replacement for OCaml's Map
module.
Height-balanced and weight-balanced binary search trees are offered out of the box. Furthermore, to advanced users, the library offers a lightweight way of implementing other balancing strategies.
The following points offer a comparison between baby
and OCaml's Set
library.
Better Performance
At the time of writing, baby
offers generally better performance than OCaml's Set
library. Its operations are generally faster (sometimes much faster; sometimes slightly faster; sometimes slightly slower) than those of the Set
library, and its memory allocation rate is slightly lower.
Constant-Time Cardinal
In contrast with the Set
library, baby
's weight-balanced trees offer a cardinal
function whose time complexity is O(1). They also offer a family of random access functions (get
, index
, etc.) whose time complexity is O(log n). Furthermore, by exploiting cardinality information, the functions subset
and equal
are sometimes able to return false
in constant time.
Better Sharing
baby
's binary operations (union
, inter
, diff
) take advantage of (and preserve) physical equality in a more aggressive way. This allows them to (sometimes) be faster and allocate less memory.
Adaptive Conversions To Sets
baby
's conversion functions of_list
, of_array
, and of_seq
have adaptive complexity. If the input data is sorted, their complexity is O(n); otherwise, their complexity gracefully degrades down to O(n.log n).
More Operations
baby
offers a few operations that do not exist in OCaml's Set
library:
- The symmetric difference,
xor
; - The conversion functions
of_array
andto_array
; - The extremum-removal functions
remove_min_elt
andremove_max_elt
; - The enumeration API in the submodule
Enum
. Enumerations should be slightly faster than standard sequences, and are able to efficiently seek ahead, via the functionfrom
.
Documented Complexity
In baby
, the time complexity of every operation is documented.
Compatibility
baby
is perfectly compatible with OCaml's Set library. In other words, using Baby.W.Set
instead of Set
is safe.
As a word of warning, though, if the equivalence relation on elements is coarser than equality (that is, if compare x y = 0
does not imply x = y
), then Baby.W.Set
and Set
might behave differently when a choice must be made between two equivalent elements. This can occur in union
, of_list
, of_array
, of_seq
, add_seq
, map
.
Preview of Stripe client and mock server - DkStdRestApis
Archive: https://discuss.ocaml.org/t/ann-preview-of-stripe-client-and-mock-server-dkstdrestapis/14841/1
jbeckford announced
I am pleased to announce that Stripe is the first REST API available in the DkStdRestApis project:
https://github.com/diskuv/DkStdRestApis?tab=readme-ov-file
That README has a 10-minute quick start; you can do it with or without a Stripe account.
The Stripe client and mock server have Apache 2.0 licensing and were generated using a new OpenAPI code generator. The code generator is not part of this preview announcement (wait until DkCoder 0.4 announcement) but since there have been a couple generators released in the past month perhaps it is best to say what is different:
- Both client and server source code are generated. The client examples include direct web requests by cohttp-lwt-curl (
src/DkStdRestApis_NotStripe/Curl2.ml
) and also indirectly by printing thecurl -d name=value https://api.stripe.com/...
command (src/DkStdRestApis_NotStripe/CurlCmd.ml
). The mock server example (src/DkStdRestApis_NotStripe/ServerTiny.ml
) uses @c-cube 's excellent tiny_httpd daemon. - Very small dependency cone that works on Windows/macOS/Linux (including the REST server). And the minimum OCaml version will be 4.14 for the foreseeable future.
- My focus is not on the code generator but having working, maintainable REST clients for the major cloud/SaaS services that can be included in DkCoder's liberally licensed standard library. The server feature was a pleasant but very unplanned accident. If I do take time to develop fancier server features (ex. replaying mocks from a corpus, etc.) those additions will not be open source.
- It is intended to have high coverage of OpenAPI features. Today that includes form URL encoding, sum types, server-side polymorphism and style/explode support. The only major feature that is intentionally unsupported is the
not
composition operator (have no idea how to express negation in OCaml's type system!).
Now for the problems:
- Stripe only compiles in bytecode mode. Why? The generated modules are huge (8+ MB in total) because Stripe's specification is 6MB. Native compilation can't handle that today.
- I'm not releasing to opam until I'm sure that native compilation won't denial-of-service developer and opam machines. I'm also waiting for some Windows patches to dependencies to be released.
Thanks to @vlaviron for helping solve some of the compilation scaling problems. And thanks to Nomadic Labs (and OCamlPro?) for developing Json_encoding and @anuragsoni for developing Routes; they are both bidirectional + lightweight + foundational.
Report bugs / add stars in the DkCoder project.
opam 2.2.0 rc1 release
R. Boujbel announced
We’re once again very excited to announce this first release candidate (and hopefully only) for opam 2.2.0.
What’s new in this rc?
- Fix
opam upgrade
wanting to keep rebuilding the compiler (as now it contains anx-env-path-rewrite
field) - Provide defaults so
opam init -y
no longer asks questions on Windows - Fix
OpamConsole.menu
when there are more than 9 options (can happen on Windows) - A couple more fixes and general improvements
:open_book: You can read our blog post for more information about these changes and more, and for even more details you can take a look at the release note or the changelog.
Windows issues
Configuration of Windows is tricky, so please don’t be too disheartened if things don’t work instantly. If something doesn’t work first time, please do report it , even if you manage to find a way to workaround it. If opam didn’t elegantly tell you what was wrong, then it’s a bug and we’d love to hear about it, rather than ending up with a series of workarounds flying around. It’s no problem at all for us to receive a bug report which turns out to be user error - we’d far rather that than not hear bugs which are opam’s error! :scream_cat:
How to upgrade
For Unix systems
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0~rc1"
or from PowerShell for Windows systems
Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/ocaml/opam/master/shell/install.ps1) }"
We’re planning for a final opam 2.2.0 release next week, so please do report any issue you encounter on our bug-tracker .
Project wide occurrences
vds announced
I am very excited to announce the first release of Merlin and Ocaml-LSP with support for project-wide occurrences 🥳. More precisely, it is now possible to query for every usage of any value (and type, modules, etc.) anywhere in a project built with Dune. This is a very handy tool for code navigation !
Requirements
- OCaml 5.2
- Latest Dune (>=
3.16.0
) - Latest Merlin (>=
5.1-502
) - Latest OCaml-LSP preview (
1.18.0~5.2preview
)
Usage
- Build the new
@ocaml-index
alias.
> We recommend running the indexation in watch mode along with your usual targets: dune build @ocaml-index --watch
so that the index is always up to date.
- Use the
Find/Peek all references
feature of LSP-based plugins- or
merlin-project-occurrences
in emacs - or
OccurrencesProjectWide
in vim.
- or
- Enjoy jumping around 🦘
More information and bug reports
Bug reports and feature requests should be submitted to the Merlin issue tracker. There are already some known issues like the absence of declarations in the results and the impossibility to query from a declaration. Progress on occurrences can be tracked in a pinned meta-issue. If you are interested in contributing and learning more about the feature do not hesitate to join the first public dev-meeting on Thursday !
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.