Attn: Development Editor, Latest OCaml Weekly News
Alan Schmitt <[email protected]>
| Newsgroups | gmane.comp.lang.caml.inria |
|---|---|
| Message-ID | <[email protected]> |
Hello
Here is the latest OCaml Weekly News, for the week of November 07 to 14,
2023.
Table of Contents
─────────────────
Release of Topiary 0.3.0
First release of OCaml bindings to the Polars dataframe library
How-To: Buck 2 and OCaml - Build system
Release of Moonpool 0.5
Zipc 0.1.0
New Tutorials on Basics of OCaml
cll 0.2.0 - mutable circular/cyclic doubly linked lists
Global dead code elimination in js_of_ocaml
Old CWN
Release of Topiary 0.3.0
════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-topiary-0-3-0/13381/1>
Nicolas Jeannerod announced
───────────────────────────
Hi everyone,
We are pleased to announce the release of [Topiary v0.3.0 – Dreamy
Dracaena].
[Topiary v0.3.0 – Dreamy Dracaena]
<https://github.com/tweag/topiary/releases/tag/v0.3.0>
What is Topiary?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
[Topiary] is a formatter for OCaml and a universal formatting engine.
It is a tool in the Tree-sitter ecosystem, designed for formatter
authors and formatter users. Authors can create a formatter without
having to write their own engine or even their own parser. Users
benefit from uniform code style and the convenience of using a single
formatter tool across multiple languages. Topiary is written in Rust
and developed by [Tweag].
[Topiary] <https://topiary.tweag.io/>
[Tweag] <https://www.tweag.io/>
What’s new?
╌╌╌╌╌╌╌╌╌╌╌
From an OCaml user’s perspective, this release mostly includes the
following changes:
• We [reworked the command line interface]; see [the migration guide].
• We improved the included formatting for OCaml and fixed issues.
• We added rough support for OCamlLex. This does not yet include
injected OCaml pieces of code but [this feature is on its way].
There is more but we will point you to the [release], the [change log]
or [all the changes] for those.
[reworked the command line interface]
<https://www.tweag.io/blog/2023-10-05-cli-ux-in-topiary/>
[the migration guide]
<https://github.com/tweag/topiary/blob/v0.3.0/docs/migration-0.2-0.3.md>
[this feature is on its way]
<https://github.com/tweag/topiary/issues/579>
[release] <https://github.com/tweag/topiary/releases/tag/v0.3.0>
[change log] <https://github.com/tweag/topiary/blob/v0.3.0/CHANGELOG.md>
[all the changes]
<https://github.com/tweag/topiary/compare/v0.2.3...v0.3.0>
How to get it?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌
You can try Topiary without installing it with our [online
playground]. Topiary is also available via OPAM so you can simply rely
on `opam install topiary'. If you are curious as to how we packaged a
Rust project in OPAM, we have [just the blog post]. Nix users, you can
find Topiary in nixpkgs or rely on the flake `github:tweag/topiary'.
Finally, since this version, statically-linked binaries are available
for download from the [GitHub release].
We hope you like it; do try, report issues, ask for features, or tell
us your love!
Cheers, The Topiary team.
blog/announce:
<https://www.tweag.io/blog/2023-03-09-announcing-topiary/>
[online playground] <https://topiary.tweag.io/playground/>
[just the blog post]
<https://www.tweag.io/blog/2023-06-29-packaging-topiary-in-opam/>
[GitHub release] <https://github.com/tweag/topiary/releases/tag/v0.3.0>
First release of OCaml bindings to the Polars dataframe library
═══════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-ocaml-bindings-to-the-polars-dataframe-library/13382/1>
mt_caret announced
──────────────────
Hi everyone!
I’m excited to share a project I’ve been working on: [polars-ocaml],
some OCaml bindings to the Polars dataframe library. If you’ve ever
wanted to do data science or tabular data processing in OCaml, please
consider trying this out!
[Polars] is a quite performant dataframe library written in Rust, with
an API that is built on top of the Apache Arrow format with a focus on
performance, utilizing parallelism and SIMD to get pretty big speedups
compared to regular records or libraries like pandas.
We’ve ported most of the examples in the Polars user guide to OCaml in
the form of expect tests:
<https://github.com/mt-caret/polars-ocaml/tree/main/guide> I encourage
folks to take a look if you’re interested in seeing some examples of
idiomatic usage of polars-ocaml; I think the labelled arguments and
use of GADTs have made the API quite nice to work with!
[polars-ocaml] <https://github.com/mt-caret/polars-ocaml>
[Polars] <https://www.pola.rs/>
How to get it
╌╌╌╌╌╌╌╌╌╌╌╌╌
We’ve just released the first version to opam, so you can install it
with `opam install polars'. It also works with OCaml jupyter notebooks
via [ocaml-jupyter]:
<https://global.discourse-cdn.com/business7/uploads/ocaml/optimized/2X/6/61e1e66e5976caabed9aed094fe89640306d7b18_2_978x1000.png>
[ocaml-jupyter] <https://github.com/akabe/ocaml-jupyter>
Contributing
╌╌╌╌╌╌╌╌╌╌╌╌
If you find any issues or have any questions, feel free to comment or
raise an issue on GitHub. While we’ve exposed a fair amount of polars
functionality, there’s quite a lot more we haven’t gotten around to,
so PRs are very welcome!
How-To: Buck 2 and OCaml - Build system
═══════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/how-to-buck-2-and-ocaml-build-system/13334/8>
Continuing this thread, Roland Csaszar announced
────────────────────────────────────────────────
Added a chapter on how to generate the Merlin files: [Using Buck 2
with OCaml-LSP or Merlin]
[Using Buck 2 with OCaml-LSP or Merlin]
<https://github.com/Release-Candidate/OCaml-Buck-2-Examples#using-buck-2-with-ocaml-lsp-or-merlin>
Release of Moonpool 0.5
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-moonpool-0-5/13387/1>
Simon Cruanes announced
───────────────────────
Dear OCaml enjoyers,
I’m quite giddy at the opportunity to announce the release of Moonpool
0.5. [Moonpool] is a MIT-licensed thread-pool library for OCaml 5,
with an eye towards mixed IO and CPU workloads.
Moonpool’s unique[^1] design allows the creation of multiple thread
pools that share an underlying domain pool. Due to how domains work in
OCaml 5, there should be at most `n' domains active at once, where `n'
is roughly the number of cores on the machine. For mixed workloads
that rely on threads, this is not really adequate as it means that
only `n' tasks can run or block on IO at the same time. Instead
Moonpool permits the creation of many more threads, possibly in
independent pools (ie. with independent schedulers), for different
workloads.
Moonpool also provides some concurrency primitives such as futures,
locks, and a blocking queue.
This release ([changelog]) has seen a lot of change in Moonpool: there
are now two distinct pool implementations that abide by the same
`Runner' interface:
• “fifo” pool: a simple pool with a single blocking queue for
workloads with coarse granularity tasks that value latency (e.g. a
web server)
• “ws” pool: a work-stealing pool for heavy compute workloads that
feature a lot of await/fork-join, with a lot of help from Sadiq, KC,
and especially Vesa Karvonen (@polytypic) to whom I’m very grateful
for his help and explanations.
Documentation can be found [here].
[^1]: for now, at least.
[Moonpool] <https://github.com/c-cube/moonpool>
[changelog] <https://github.com/c-cube/moonpool/releases/tag/v0.5>
[here] <https://c-cube.github.io/moonpool/dev/moonpool/index.html>
Zipc 0.1.0
══════════
Archive: <https://discuss.ocaml.org/t/ann-zipc-0-1-0/13388/1>
Daniel Bünzli announced
───────────────────────
Hello,
It’s my pleasure to announce the first release of the Zipc library:
Zipc is an in-memory [ZIP archive] and [deflate]
compression codec. Other compression formats in ZIP
archives can be supported by using third-party libraries.
Zipc has no dependencies and no C code. It is distributed
under the ISC license.
This first release benefited from and finishes a generous grant from
the [OCaml Software Foundation] for the years 2022 to 2023. My
[donators] are also paramount to be able to get these things ironed
and out for reasonable third-party usage, rather than them remaining
private kludges to support urgent needs ;–)
Thank you all for your support.
Homepage: <https://erratique.ch/software/zipc>
Docs: <https://erratique.ch/software/zipc/doc> (or `odig doc zipc')
Install: `opam install zipc' (once this [PR] is merged)
Daniel
[ZIP archive]
<https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT>
[deflate] <https://www.rfc-editor.org/rfc/rfc1951>
[OCaml Software Foundation] <http://ocaml-sf.org/>
[donators] <https://github.com/sponsors/dbuenzli>
New Tutorials on Basics of OCaml
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/new-tutorials-on-basics-of-ocaml/13396/1>
Cuihtlauac Alvarado announced
─────────────────────────────
Dear OCamlers
The OCaml.org team is happy to announce the publication of two new
tutorials:
1. [Values and Functions]
2. [Basic Data Types and Pattern Matching]
These pages teach the basics of OCaml, starting from what is a value
and continuing to basic types. Before them, the documentation on
OCaml.org assumed a lot more understanding and made it hard for
beginners to learn OCaml using OCaml.org. There are more gaps to fill,
but alongside the [recently published] “Get Started” docs ([Installing
OCaml], [A Tour of OCaml] and [Your First OCaml Program]), this will
allow people to use OCaml.org to start learning the language.
Unlike “Get Started” documents, these two have a narrower focus:
• The former is new. It covers values, definitions, functions,
environments, scopes, closures, and shadowing.
• The latter is mostly new. It reuses some of the “Data Types And
Matching” materials. But it also replaces it. It covers predefined
types, variants, records, and pattern matching.
They form a series. “Values and Functions” goes first, and “Basic Data
Types And Pattern Matching” goes after. The only prerequisite is the
completion of the “Get Started” series.
We’ve received and included feedback on them when they were pull
requests. However, as of any fresh release, there’s room for fixes and
improvements. Don’t hesitate to share your opinion, comments or
suggestions. Since this is beginner-oriented material, we’d appreciate
very much if you find brave enough people to learn OCaml using them
and provide a report on how it went.
Hope it helps
[Values and Functions] <https://ocaml.org/docs/values-and-functions>
[Basic Data Types and Pattern Matching]
<https://ocaml.org/docs/basic-data-types>
[recently published]
<https://discuss.ocaml.org/t/ann-new-get-started-documentation-on-ocaml-org>
[Installing OCaml] <https://ocaml.org/docs/installing-ocaml>
[A Tour of OCaml] <https://ocaml.org/docs/tour-of-ocaml>
[Your First OCaml Program] <https://ocaml.org/docs/your-first-program>
cll 0.2.0 - mutable circular/cyclic doubly linked lists
═══════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-cll-0-2-0-mutable-circular-cyclic-doubly-linked-lists/13416/1>
Rob Anderson announced
──────────────────────
Hi all,
This is [cll], a simple circular linked list implementation designed
for O(1) insertion and removal, O(n) traversal, and close to O(1)
search using a backing hashtable.
Currently it supports:
• initialising a circular linked list from a standard list with `init'
• traversing through the list using `next' and `prev' functions
• adding and removing elements at the current head using `add' and
`pop'
• finding and navigating to elements in the list either by iterating
through all elements or looking up elements with the backing
hashtable
• `seek' to iterate through and perform an O(n) lookup
• `find' to perform an O(1) lookup
• iterate through the full list from the current head and apply a
given function to each element with `iter'
• output the current circular list as a standard Ocaml list using
`to_list'
I started developing `cll' after writing circular linked list
implementations for a couple of programming puzzles, and decided that
writing and publishing a library was a good way for me to continue
learning Ocaml.
I have included examples in the [Github repo] for both of these
puzzles: Advent of code 2020 day 23 (crab cups), and the Josephus
problem Codewars kata.
[cll] <https://opam.ocaml.org/packages/cll/>
[Github repo] <https://github.com/jamsidedown/ocaml-cll>
Global dead code elimination in js_of_ocaml
═══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-global-dead-code-elimination-in-js-of-ocaml/13417/1>
Micah Cantor announced
──────────────────────
Hi everyone!
We recently [merged] a large change to [js_of_ocaml] that implements a
new *global dead code elimination* pass. I wrote the following blog
post which explains the impact of this change, why it was necessary,
and all the important implementation details:
<https://www.micahcantor.com/blog/js-of-ocaml-dead-code/>
*In a nutshell*, this change addresses a long-known limitation of
js_of_ocaml to remove unused code from functors (like Map and Set).
Previously, even if only one function from these modules was used, all
of the function definitions would be included in the JavaScript
executable, significantly increasing the output size.
*In practice*, programs that compile with js_of_ocaml and depend on
libraries that expose large functor interfaces (like [TyXML], for
instance) could see significant decreases in output size. In
particular, for a minimal website using tyxml, we saw a decrease by
21kb or 11% of the total JS size. Websites using Map and Set could
also see size decreases of up to 10kb for each module.
The new pass is enabled by default, and from our benchmarking, it
shouldn’t contribute a significant increase in compile time for most
programs (as in, less than 100ms). However, some very large projects
(like `ocamlc' or the OCaml toplevel compiler) could see a compile
time increase of 1-5%. If this is significant, the pass can be
disabled with `--disable globaldeadcode'.
Thank you to [Tarides] for supporting this work through my internship,
and in particular to my incredible mentors @vouillon , @otini and
@jmid . Also thanks to @hhugo for reviewing and providing feedback on
the pull request.
[merged] <https://github.com/ocsigen/js_of_ocaml/pull/1503>
[js_of_ocaml] <https://github.com/ocsigen/js_of_ocaml>
[TyXML] <https://ocsigen.org/tyxml/latest/manual/intro>
[Tarides] <https://tarides.com/>
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] <mailto:[email protected]>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[caml-list] <https://sympa.inria.fr/sympa/info/caml-list>
[Alan Schmitt] <https://alan.petitepomme.net/>