* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-12-22 8:48 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-12-22 8:48 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 12455 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of December 15 to 22,
2020.
Table of Contents
─────────────────
ocaml-lsp-server 1.4.0
OCaml 4.12.0, third alpha release
Lwt 5.4.0, Lwt_ppx 2.0.2, Lwt_react 1.1.4 releases
Senior software engineer at Docent, France - Remote OK
Old CWN
ocaml-lsp-server 1.4.0
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocaml-lsp-server-1-4-0/6996/1>
Rudi Grinberg announced
───────────────────────
On behalf of the ocaml-lsp team, it is my pleasure to announce version
1.4.0. This release introduces support for [automatic signature help].
Signature help is not yet present in all possible contexts. We intend
to improve to support as many relevant language constructs as possible
in the future. Many thanks to @mnxn for implementing this feature.
The full change log is replicated at the end of this post for your
convenience.
Happy Holidays!
• Support cancellation notifications when possible. (#323)
• Implement signature help request for functions (#324)
• Server LSP requests & notifications concurrently. Requests that
require merlin are still serialized. (#330)
[automatic signature help]
<https://code.visualstudio.com/api/language-extensions/programmatic-language-features#help-with-function-and-method-signatures>
OCaml 4.12.0, third alpha release
═════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-4-12-0-third-alpha-release/6997/1>
octachron announced
───────────────────
The release of OCaml 4.12.0 is approaching. We have released a third
alpha version to help fellow hackers join us early in our bug hunting
and opam ecosystem fixing fun.
Beyond the usual bug fixes, this new alpha version contains two small
API fixes for statmemprof and the Unix module. (Keen-eyed readers
might notice a breaking change in the change log below but this
concerns a corner case of a corner case of the type system that should
not affect anyone.)
The base compiler can be installed as an opam switch with the
following commands
┌────
│ opam update
│ opam switch create 4.12.0~alpha3
│ --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 <switch_name> --packages=ocaml-variants.4.12.0~alpha3+options,<option_list>
│ --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where <option_list> is a comma separated list of ocaml-option-*
packages. For instance, for a flambda and afl enabled switch:
┌────
│ opam switch create 4.12.0~alpha3+flambda+afl
│ --packages=ocaml-variants.4.12.0~alpha3+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 for the alpha is also available at these addresses:
• <https://github.com/ocaml/ocaml/archive/4.12.0-alpha3.tar.gz>
• <https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.0~alpha3.tar.gz>
If you want to test this version, it is advised to install the alpha
opam repository
<https://github.com/kit-ty-kate/opam-alpha-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.
If you find any bugs, please report them here:
<https://github.com/ocaml/ocaml/issues>
Changes from the second alpha:
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• *additional fixes* [1128], [7503], [9036], [9722], +[10069]:
EINTR-based signal handling. When a signal arrives, avoid running
its OCaml handler in the middle of a blocking section. Instead,
allow control to return quickly to a polling point where the signal
handler can safely run, ensuring that
• [9907]: Fix native toplevel on native Windows. (David Allsopp,
review by Florian Angeletti)
• [10056]: Memprof: ensure young_trigger is within the bounds of the
minor heap in caml_memprof_renew_minor_sample (regression from
[8684]) (David Allsopp, review by Guillaume Munch-Maccagnoni and
Jacques-Henri Jourdan)
• [10062]: set ARCH_INT64_PRINTF_FORMAT correctly for both modes of
mingw-w64 (David Allsopp, review by Xavier Leroy)
• [10025]: Track custom blocks (e.g. Bigarray) with Statmemprof
(Stephen Dolan, review by Leo White, Gabriel Scherer and
Jacques-Henri Jourdan)
• [10070]: Fix Float.Array.blit when source and destination arrays
coincide. (Nicolás Ojeda Bär, review by Alain Frisch and Xavier
Leroy)
• *additional fixes* [9869], +[10073]: Add Unix.SO_REUSEPORT (Yishuai
Li, review by Xavier Leroy, amended by David Allsopp)
• [9877]: manual, warn that multi-index indexing operators should be
defined in conjunction of single-index ones. (Florian Angeletti,
review by Hezekiah M. Carty, Gabriel Scherer, and Marcello Seri)
• [10046]: Link all DLLs with -static-libgcc on mingw32 to prevent
dependency on libgcc_s_sjlj-1.dll with mingw-w64 runtime 8.0.0
(previously this was only needed for dllunix.dll). (David Allsopp,
report by Andreas Hauptmann, review by Xavier Leroy)
• [9896]: Share the strings representing scopes, fixing some
regression on .cmo/.cma sizes (Alain Frisch and Xavier Clerc, review
by Gabriel Scherer)
• [10044]: Always report the detected ARCH, MODEL and SYSTEM, even for
bytecode- only builds (fixes a "configuration regression" from 4.08
for the Windows builds) (David Allsopp, review by Xavier Leroy)
• [10071]: Fix bug in tests/misc/weaklifetime.ml that was reported in
[10055] (Damien Doligez and Gabriel Scherer, report by David
Allsopp)
• *breaking change* [8907], [9878]: `Typemod.normalize_signature' uses
wrong environment Does not treat submodules differently when
normalizing conjunctive types in polymorphic variants. This may
break code that expose conjunctive types in inferred
interface. (Jacques Garrigue, report and review by Leo White)
• [9739], [9747]: Avoid calling type variables, types that are not
variables in recursive occurence error messages (for instance, "Type
variable int occurs inside int list") (Florian Angeletti, report by
Stephen Dolan, review by Armaël Guéneau)
• [10048]: Fix bug with generalized local opens. (Leo White, review by
Thomas Refis)
[1128] <https://github.com/ocaml/ocaml/issues/1128>
[7503] <https://github.com/ocaml/ocaml/issues/7503>
[9036] <https://github.com/ocaml/ocaml/issues/9036>
[9722] <https://github.com/ocaml/ocaml/issues/9722>
[10069] <https://github.com/ocaml/ocaml/issues/10069>
[9907] <https://github.com/ocaml/ocaml/issues/9907>
[10056] <https://github.com/ocaml/ocaml/issues/10056>
[8684] <https://github.com/ocaml/ocaml/issues/8684>
[10062] <https://github.com/ocaml/ocaml/issues/10062>
[10025] <https://github.com/ocaml/ocaml/issues/10025>
[10070] <https://github.com/ocaml/ocaml/issues/10070>
[9869] <https://github.com/ocaml/ocaml/issues/9869>
[10073] <https://github.com/ocaml/ocaml/issues/10073>
[9877] <https://github.com/ocaml/ocaml/issues/9877>
[10046] <https://github.com/ocaml/ocaml/issues/10046>
[9896] <https://github.com/ocaml/ocaml/issues/9896>
[10044] <https://github.com/ocaml/ocaml/issues/10044>
[10071] <https://github.com/ocaml/ocaml/issues/10071>
[10055] <https://github.com/ocaml/ocaml/issues/10055>
[8907] <https://github.com/ocaml/ocaml/issues/8907>
[9878] <https://github.com/ocaml/ocaml/issues/9878>
[9739] <https://github.com/ocaml/ocaml/issues/9739>
[9747] <https://github.com/ocaml/ocaml/issues/9747>
[10048] <https://github.com/ocaml/ocaml/issues/10048>
Lwt 5.4.0, Lwt_ppx 2.0.2, Lwt_react 1.1.4 releases
══════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-lwt-5-4-0-lwt-ppx-2-0-2-lwt-react-1-1-4-releases/7001/1>
Raphaël Proust announced
────────────────────────
We are glad to announce the release of version 5.4.0 of Lwt, version
2.0.2 of Lwt_ppx, and version 1.1.4 of Lwt_react.
<https://github.com/ocsigen/lwt/releases/tag/5.4.0>
It can be installed from opam as usual:
┌────
│ opam update
│ opam upgrade lwt lwt_ppx lwt_react
└────
OCaml 4.12 compatibility
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
With this release, Lwt is now compatible with OCaml 4.12. Thanks
@kit-ty-kate for the contribution towards this support.
Thanks as well to all the other contributors for all the other
improvements that made it into this release. Check-out the release's
changelog (link above) for a full list of bugfixes and additions.
Maintainers' notes
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
As per [a previous announce] I am a co-maintainer of Lwt. With this
release I'm taking on a more and more central role in the maintenance
effort. Whilst I've received a lot of help getting this release
together, I'm most likely the one responsible for any issues in the
process.
I'd like to thank @antron who is as stellar with maintenance of the
project as he is with guiding me through the learning process. I'd
also like to thank the opam-repository team who stepped up very
quickly to fix some CI-related build-issues. And I'd like to thank my
employer, [Nomadic Labs], who agreed to make Lwt maintenance part of
my day job.
I'm looking forward to all your bug reports, pull requests, comments,
ideas, questions, remarks, as well as any sort of feedback. Don't
hesitate to get in touch!
[a previous announce]
<https://discuss.ocaml.org/t/announcing-a-new-maintainer-for-lwt/6192>
[Nomadic Labs] <https://nomadic-labs.com/>
Senior software engineer at Docent, France - Remote OK
══════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/senior-software-engineer-at-docent-france-remote-ok/7002/1>
Thibaut Mattio announced
────────────────────────
Docent, a company I'm working with, is recruiting an OCaml
developer. You can see the job post [here]
The team and project are really nice, I would definitely recommend it!
I've built the current version of the backend, so don't hesitate to
reach out (thibaut.mattio@gmail.com) if you have any questions on the
tech (or other).
[here]
<https://www.notion.so/docentart/OCaml-Developer-bc047ff6c80b448e814943f7116fa14b>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 24451 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-04-20 9:07 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-04-20 9:07 UTC (permalink / raw)
To: lwn, cwn, caml-list
[-- Attachment #1: Type: text/plain, Size: 18195 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of April 13 to 20,
2021.
Table of Contents
─────────────────
Preface (initial release)
OCaml Users and Developers Workshop 2021
Timere 0.1.3 - Dealing with time and time zones has never been easier
Release of `multipart_form.0.2.0'
Engineer position for the development of the Squirrel prover
Martin Jambon presentation on Semgrep, Wed April 21 @ 7pm Central
Old CWN
Preface (initial release)
═════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-preface-initial-release/7669/1>
Xavier Van de Woestyne announced
────────────────────────────────
Hello, @d-plaindoux and @pytre and I are very happy to present
*Preface*, a project that has occupied part of our free time for
almost 2 years. We received a lot of help from various people (as
mentioned in the [CREDITS] page), including some present on this forum
(@gasche, @octachron and @snowleopard)
Preface is an opinionated library designed to facilitate
the handling of recurring functional programming idioms in
[OCaml]. Many of the design decisions were made in an
attempt to calibrate, as best as possible, to the OCaml
language. Trying to get the most out of the module
language. *The name "preface" is a nod to "Prelude"* .
• [Github repository]
• [Online documentation]
[CREDITS]
<https://github.com/xvw/preface/blob/master/CREDITS.md#warm-thanks-and-help>
[OCaml] <https://ocaml.org>
[Github repository] <https://github.com/xvw/preface>
[Online documentation]
<https://ocaml-preface.github.io/preface/Preface/index.html>
About the project, and motivation
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
When learning functional programming, one is often confronted with
constructs derived (or not) from category theory. Languages such as
Haskell offer very complete libraries to use them, and thus,
facilitate their learning. In OCaml, it often happens that these
abstractions are buried in the heart of certain libraries/projects
([Lwt], [Cmdliner], [Bonsai], [Dune] etc.). This is why one of the
objectives of Preface is to propose tools for concretising these
abstractions, at least as a pedagogical tool.
[Lwt] <https://ocsigen.org/lwt/latest/manual/manual>
[Cmdliner] <https://erratique.ch/logiciel/cmdliner>
[Bonsai] <https://github.com/janestreet/bonsai>
[Dune] <https://dune.build>
Is Preface useful
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Since OCaml allows for efficient imperative programming, Preface is
probably not really useful for building software. However, we (the
maintainers) think that Preface can be useful for a few things:
• technical experimentation with abstractions (especially those from
the Haskell world) that allow programming in a fun style.
• As an educational tool. Many teaching aids generally only offer the
minimal interfaces to these abstractions. Preface tries to be as
complete as possible.
• It was a lot of fun to make. The last point is obviously the
lightest but building Preface was really fun! So even if some people
won't see the point… *we had fun making it*!
Let's imagine this scenario! Oh, there's this article that seems to
describe quite precisely how to solve `this complex problem',
elegantly, using this `collection of abstractions'. After reading, the
article is clear and I know how to use this `collection of
abstractions' in practice. I would like to test it. Not having enough
RAM to install Cabal, I decided to do it in OCaml. But as one
abstraction leads to another, I am obliged to build an armada of
things and I abandon my experimentation.
So now, rather than doing it, locally, for the understanding of an
article, I add it in Preface.
Additional links
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The [README] is quite expansive on motivations and some design
choices, but we have tried to add some concrete guides:
• [ Understanding the module breakdown of Preface]
• [Effect handling using Freer]
• [Error handling with Result/Validation and a Free Applicative]
And in addition here is a project, by a friend of ours, that uses
Preface, to build static blog generators (very original isn't it :P),
the code is highly documented and can be an entry point into how to
use it: [Github repository of the project]
[README] <https://github.com/xvw/preface#preface>
[ Understanding the module breakdown of Preface]
<https://github.com/xvw/preface/blob/master/guides/option_instantiation.md>
[Effect handling using Freer]
<https://github.com/xvw/preface/blob/master/guides/freer_effect_handling.md>
[Error handling with Result/Validation and a Free Applicative]
<https://github.com/xvw/preface/blob/master/guides/error_handling.md>
[Github repository of the project]
<https://github.com/xhtmlboi/wordpress>
Conclusion
╌╌╌╌╌╌╌╌╌╌
Preface does not offer much that is new, but we have tried to make it
user-friendly and to document as much as possible the code and design
choices. It's a lot of fun to build… and it will probably be just as
much fun to maintain.
*We are extremely open to contributions and feedback.*
And my last words will be a warm thank you to the OCaml ecosystem that
has facilitated so much of our development: Testing with [Alcotest]
and [QCheck] is a pleasure. [Dune] is a fast and pleasant build
system. [ODoc] has allowed us to have more control over the generation
of documentation, especially with the `@inline' comment (on includes)
which allows signatures from different modules to be merged. And [MDX]
which I did not know at all and which is used extensively for guides.
I hope you can find interest in this project! Good luck with the rest
of the containment (for those concerned).
[Alcotest] <https://github.com/mirage/alcotest>
[QCheck] <https://github.com/c-cube/qcheck>
[Dune] <https://dune.build>
[ODoc] <https://github.com/ocaml/odoc>
[MDX] <https://github.com/realworldocaml/mdx>
OCaml Users and Developers Workshop 2021
════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-users-and-developers-workshop-2021/7673/1>
Frédéric Bour announced
───────────────────────
It is my pleasure to invite submissions to the OCaml Users and
Developers Workshop 2021, which is again co-located with ICFP and will
be held virtually this year.
The OCaml Users and Developers Workshop brings together industrial
users of OCaml with academics and hackers who are working on extending
the language, type system, and tools. Previous editions have been
co-located with ICFP 2012 in Copenhagen, ICFP 2013 in Boston, ICFP
2014 in Gothenburg, ICFP 2015 in Vancouver, ICFP 2016 in Nara, ICFP
2017 in Oxford, ICFP 2018 in St Louis, ICFP 2019 in Berlin, and was
virtual for ICFP 2020, following the OCaml Meetings in Paris in 2010
and 2011.
Important Links
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• [https://icfp21.sigplan.org/home/ocaml-2021 ]
• [https://ocaml2021.hotcrp.com ]
[https://icfp21.sigplan.org/home/ocaml-2021 ]
<https://icfp21.sigplan.org/home/ocaml-2021>
[https://ocaml2021.hotcrp.com ] <https://ocaml2021.hotcrp.com>
Important dates
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Thursday 20th May (any time zone): Abstract submission deadline
• Friday 18th July: Author notification
• Friday 27th August: OCaml Workshop
Scope
╌╌╌╌╌
Presentations and discussions focus on the OCaml programming language
and its community. We aim to solicit talks on all aspects related to
improving the use or development of the language and its programming
environment, including, for example (but not limited to):
• compiler developments, new backends, runtime and architectures
• practical type system improvements, such as GADTs, first-class
modules, generic programming, or dependent types
• new library or application releases, and their design rationales
• tools and infrastructure services, and their enhancements
• prominent industrial or experimental uses of OCaml, or deployments
in unusual situations.
Presentations
╌╌╌╌╌╌╌╌╌╌╌╌╌
Presentations will be held in the online format. Each presentation
comprise a prerecorded presentation and an interactive live Q&A
session after the talk. Each talk will be re-translated three times in
different time zones. Session chairs and volunteers will assist the
authors in preparing and casting the presentation. Each presentation
will be made available through the ocaml.org website.
Submission
╌╌╌╌╌╌╌╌╌╌
To submit a presentation, please register a description of the talk
(about 2 pages long) at <https://ocaml2021.hotcrp.com/> providing a
clear statement of what will be provided by the presentation: the
problems that are addressed, the solutions or methods that are
proposed.
LaTeX-produced PDFs are a common and welcome submission format. For
accessibility purposes, we ask PDF submitters to also provide the
sources of their submission in a textual format, such as .tex
sources. Reviewers may read either the submitted PDF or the text
version.
Camera ready presentations
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
A pre-recorded versions of accepted presentation shall be provided
before August, 13th. Volunteers will provide technical assistance to
authors as well as provide necessary feedback and ensure that all
videos match our quality standards.
ML family workshop
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The ML family workshop, held on the previous day, deals with general
issues of the ML-style programming and type systems, focuses on more
research-oriented work that is less specific to a language in
particular. There is an overlap between the two workshops, and we have
occasionally transferred presentations from one to the other in the
past. Authors who feel their submission fits both workshops are
encouraged to mention it at submission time and/or contact the Program
Chairs.
Program Commitee
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Frédéric Bour, Tarides, France
• Cristina Rosu, Janestreet, UK
• Hakjoo Oh, Korea University, Korea
• Hugo Heuzard, Janestreet, UK
• Jeffrey A. Scofield, Formalsim, USA
• Jonathan Protzenko, MSR, USA
• Joris Giovanangeli, Ahrefs, Singapore
• Jun Furuse, Dailambda, Japan
• Kihong Heo, KAIST, Korea
• Kate Deplaix, OCaml Labs, UK
• Medhi Bouaziz, Nomadic Labs, France
• Simon Castellan, INRIA, France
• Ryohei Tokuda, Idein, Japan
• Vaivaswatha Nagaraj, Zilliqa, India
• Youyou Cong, Tokyo Institute of Technology, Japan
Questions and contact
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Please contact the PC Chair ([Frédéric Bour]) for any questions.
[Frédéric Bour] <mailto:frederic.bour@lakaban.net>
Timere 0.1.3 - Dealing with time and time zones has never been easier
═════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-timere-0-1-3-dealing-with-time-and-time-zones-has-never-been-easier/7173/2>
Darren announced
────────────────
Timere 0.2.1 has landed!
This release adds nanosecond precision support to timere (and
fractional second support at various places), along with other small
improvements.
Release of `multipart_form.0.2.0'
═════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-multipart-form-0-2-0/7704/1>
Calascibetta Romain announced
─────────────────────────────
I am pleased to announce the release of [`multipart_form']. Throughout
the development of [mrmime], we have gained a thorough knowledge of
the RFCs about email. However, these RFCs also describe mechanisms
that are found in HTTP/1.1.
[`multipart_form'] <https://github.com/dinosaure/multipart_form>
[mrmime] <https://github.com/mirage/mrmime>
Genesis
╌╌╌╌╌╌╌
More specifically, a lot of work has been done on [RFC 2045] & [RFC
2046] (see [RFC 7578 § 4]) which describe the `multipart' format
(found in emails and in `HTTP/1.{0,1}' requests when serializing a
`<form>').
From this work (~ 2 years), we decided to extract the parts allowing
to manipulate a `multipart/form-data' content for `HTTP/1.{0,1}'
responses (plus [RFC 2183]). This resulted in the creation of
`multipart_form'.
This project is a cross between what many users have been waiting for
(for [CoHTTP] and [http/af]), a knowledge of what exists and its
limitations, and finally a development in the spirit of MirageOS.
The result is an API that is _"full stream"_. Indeed. a question arose
from the beginning, how to manipulate this format while:
• not having access to a file system (MirageOS)
• not exploding memory usage for file uploads
[RFC 2045] <https://tools.ietf.org/html/rfc2045>
[RFC 2046] <https://tools.ietf.org/html/rfc2046>
[RFC 7578 § 4] <https://tools.ietf.org/html/rfc7578#section-4>
[RFC 2183] <https://tools.ietf.org/html/rfc2183>
[CoHTTP] <https://github.com/mirage/ocaml-cohttp>
[http/af] <https://github.com/inhabitedtype/httpaf>
Memory bound implementation
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
With the help of @Armael and the [`memtrace'] tool, we were able to
implement and extend `multipart_form' so that it is easier to use and
really ensures our original assumption about memory consumption.
So we experimented with use cases like uploading very large
files. Here is the result that `memtrace' gives us with a 100Mb file:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/9/92ee2ab6fa1d4da62d894749aa4b161a95b53fb2_2_1034x590.png>
The application tries to save the games in files. We use [opium] (and
thus http/af) but tests were also done with CoHTTP. The code is
available [here] for people who want to reproduce.
[`memtrace']
<https://blog.janestreet.com/finding-memory-leaks-with-memtrace/>
[opium] <https://github.com/rgrinberg/opium>
[here]
<https://gist.github.com/dinosaure/299c421c95cec4255df7b9289eb53815>
Documentation & encoding
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Finally, a major effort has been made in the documentation to explain
in detail how to use `multipart_form'. Version `0.2.0' also adds a way
to produce a `multipart/form-data' document (experimental) with the
same constraints on memory usage.
I hope this work will be useful to a lot of people. The documentation
is available [here].
[here]
<https://dinosaure.github.io/multipart_form/multipart_form/index.html>
Engineer position for the development of the Squirrel prover
════════════════════════════════════════════════════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2021-04/msg00022.html>
David Baelde announced
──────────────────────
We are looking for an engineer to support the development of Squirrel,
an interactive theorem prover for security protocols. The position
will be funded by ERC POPSTAR. You may find more details here:
<https://people.irisa.fr/Stephanie.Delaune/internship/sujet-engineer-squirrel.pdf>
Skilled OCaml developers would be most welcome!
Martin Jambon presentation on Semgrep, Wed April 21 @ 7pm Central
═════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/martin-jambon-presentation-on-semgrep-wed-april-21-7pm-central/7709/1>
Claude Jager-Rubinson announced
───────────────────────────────
Please join us this coming Wednesday at 7pm Central when @mjambon will
talk about Semgrep, an open-source ployglot static analysis tool
written in OCaml.
Details and connection info are available at [Houston Functional
Programmers].
[Houston Functional Programmers] <https://hfpug.org>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 30654 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-04-06 9:42 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-04-06 9:42 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 10885 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 30 to April
06, 2021.
Table of Contents
─────────────────
Ecosystem Engineer and Technical Writer positions
Release of cohttp 4.0.0
Timere-parse 0.0.2, natural language parsing of date, time and duration
agrid 0.1
State of OCaml and web assembly
containers 3.3
New OCaml books?
Old CWN
Ecosystem Engineer and Technical Writer positions
═════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/job-ecosystem-engineer-and-technical-writer-positions/7571/1>
Celine announced
────────────────
[Tarides] is hiring an [Ecosystem Engineer] and a [Technical Writer].
Tarides is a tech startup based in Paris and founded in 2018. We
develop a software infrastructure platform to deploy secure,
distributed applications with strict resource contraints and
low-latency performance requirements.
We welcome applications from people of all backgrounds. We are working
hard to create a representative, inclusive and friendly team, because
we know that different experiences, perspectives and backgrounds make
for a better place.
Please, don't hesitate to contact me if you have any question, I'll be
more than happy to reply! :)
[Tarides] <https://tarides.com/>
[Ecosystem Engineer] <https://tarides.com/jobs/ecosystem-engineer>
[Technical Writer] <https://tarides.com/jobs/technical-writer>
Release of cohttp 4.0.0
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-cohttp-4-0-0/7537/2>
Continuing this thread, Calascibetta Romain said
────────────────────────────────────────────────
The work on the new conduit is steadily progressing and
will be integrated in a new major release of cohttp in the
future, once we will be confident that the API is
settled. If you want to try using it immediately, then it
is available as the [mimic ] library in ocaml-git.
I just take the opportunity to show up a tutorial about `mimic' which
is now available into the distribution of it: see [here]. Thanks for
your work about the release process.
[mimic ] <https://github.com/mirage/ocaml-git/tree/master/src/mimic>
[here] <https://mirage.github.io/ocaml-git/mimic/index.html>
Timere-parse 0.0.2, natural language parsing of date, time and duration
═══════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-timere-parse-0-0-2-natural-language-parsing-of-date-time-and-duration/7532/2>
Continuing this thread, Darren said
───────────────────────────────────
The demo site has been updated to use Timere-parse, you can now try
interacting with `Timere_parse.timere' in web browser at
<https://daypack-dev.github.io/timere-parse-demo/>
agrid 0.1
═════════
Archive: <https://discuss.ocaml.org/t/ann-agrid-0-1/7587/1>
zapashcanon announced
─────────────────────
I'm pleased to announce the first release of [agrid].
Agrid stands for *Adjustable Grid*. Adjustable grids are basically two
dimensional arrays whose width/height can be changed by adding or
removing row/column at either end (one at a time).
Here's a very short example :
┌────
│ let () =
│ let grid = Agrid.of_list [[1; 2]; [3; 4]] in
│ let grid = Agrid.snoc_row grid (Flex_array.of_list [5; 6]) in
│ Agrid.pp Format.pp_print_int Format.std_formatter grid
│ (* prints:
│ * 1; 2
│ * 3; 4
│ * 5; 6
│ *)
└────
It's based on the great [flex-array] library by [Jean-Christophe
Filliâtre] and is mainly a wrapper around it to make it easier for the
special case of two dimensional arrays.
It's been developped at [OCamlPro] while working on [mosaic] when we
wanted to ease the dataset input process, switching from a basic
textarea based input to something which looks like a spreadsheet (this
work is not yet published on the online version).
[agrid] <https://ocamlpro.github.io/agrid>
[flex-array] <https://github.com/backtracking/flex-array>
[Jean-Christophe Filliâtre] <https://www.lri.fr/~filliatr/>
[OCamlPro] <https://www.ocamlpro.com/>
[mosaic] <https://mosaic.univ-lyon1.fr/>
gasche asked and zapashcanon replied
────────────────────────────────────
Out of curiosity: In a spreadsheet, I would assume that
inserting/removing rows or columns in the middle is also a
useful operation. Would you be able to add this operation?
It's not really a spreadsheet, it's more something [like this]. I
don't think it would be really useful in the case of mosaic because
for big inputs, users are more likely to import the data from a file.
Anyway, it's possible to add this operation, but I can't think of an
efficient way to do it. I'll think about it and may add such an
operation. Actually, if it's added to flex-array, it would be trivial
to add it to agrid, so I'll probably try to add it there.
[like this] <https://www.zapashcanon.fr/~leo/atable/>
State of OCaml and web assembly
═══════════════════════════════
Archive:
<https://discuss.ocaml.org/t/state-of-ocaml-and-web-assembly/2725/15>
Deep in this thread, Emilio Jesús Gallego Arias announced
─────────────────────────────────────────────────────────
Yup, we didn't make it yet the "official" release, but it has been
used by quite a few people to avoid lack of tail-call optimization in
jsoo, live versions:
• <https://jscoq.github.io/wa/>
• <https://jscoq.github.io/wa/scratchpad.html>
It literally flies.
I guess @corwin-of-amber is the right person to comment more on his
superb efforts.
Shachar Itzhaky then added
──────────────────────────
Hi there @camarick; ocaml-wasm is very much bleeding-edge but it
already works surprisingly well and I have used it to run Coq,
esp. for the purpose of making the interactive version of Vols. I,II
from the Software Foundations textbook (see
<https://jscoq.github.io/ext/sf> and
<https://jscoq.github.io/ext/sf/tools/jscoq-tester.html>).
Of course @ejgallego is exaggerating when he says that it flies, it
still runs OCaml bytecode in interpreted mode on top of the WASM
JIT. Performance is pretty reasonable still, except in the case some
intensive Coq tactics (in which case this is a third level of
interpreter… :man_facepalming: ). The main gap right now is the
standard libraries `str', `unix', and `threads', for which I have
compiled empty stubs, because dynamic loading of libraries in WASI is
still immature. I *have* been able to compile `num' and it works
correctly because it does not depend on anything else. I am currently
investigating how to build `zarith' (which requires `gmp') because Coq
8.13 depends on it.
So yeah, this is not at all the coveted WASM backend for `ocamlc', but
it's one existing solution and you can hack on it right now. Any help
or comments are welcome!
containers 3.3
══════════════
Archive: <https://discuss.ocaml.org/t/ann-containers-3-3/7594/1>
Simon Cruanes announced
───────────────────────
I'm glad to announce the release of containers 3.3. Containers is an
extension to OCaml's standard library that strives to be compatible
with it, with more features and a few additional modules to get
dynamic arrays, heaps, S-expression parser/printer, etc.
In this release, we have new support for parsing/printing canonical
S-expressions (a simple binary-safe format), a code-generation module
for bitfields, and many improvements to existing modules in particular
in the interface between maps/set/hashtbl and iterators.
More details [in the github release].
Many thanks to the contributors, in particular @Fardale for his work
on CI and auto-doc-generation.
[in the github release]
<https://github.com/c-cube/ocaml-containers/releases/tag/v3.3>
New OCaml books?
════════════════
Archive: <https://discuss.ocaml.org/t/new-ocaml-books/5789/6>
Deep in this thread, Damien Guichard announced
──────────────────────────────────────────────
I’m also working on a free culture book. The preview is at
<https://damien-guichard.developpez.com/downloads/Algorithmic-with-OCaml.pdf>
It’s under CC-BY-SA.
Planned chapters include : Records, Type polymorphism, Modules as
functions, Conceptual graphs.
The reason why i don't contribute to @dmbaturin's effort is that my
main topic is algorithmic, ocaml is more a good way than a goal.
Damien Guichard later added
───────────────────────────
Sorry, you have to be a member of <https://www.developpez.com/> to
access this link.
Here is my 2nd try. I hope you don't need to be a member of
<https://www.aeriesguard.com/> this time.
<https://www.aeriesguard.com/media/get/504bfbe34d3f517c8acf37ffbe200f84698aca0c/Algorithmic-with-_OCaml.pdf>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 23290 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-03-30 14:55 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-03-30 14:55 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 21208 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 23 to 30,
2021.
Table of Contents
─────────────────
Theorem Proving with Coq and Ocaml
ocaml-aws 1.2
Release of `fmlib.0.2.0'
soupault: a static website generator based on HTML rewriting
Timere-parse 0.0.2, natural language parsing of date, time and duration
ocamlnet-4.1.9
Release of cohttp 4.0.0
New Try-Alt-Ergo website
Other OCaml News
Old CWN
Theorem Proving with Coq and Ocaml
══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/theorem-proving-with-coq-ocaml/7524/1>
Gregory Malecha announced
─────────────────────────
I lead the formal methods team at Bedrock Systems
(<https://bedrocksystems.com>) and we are looking to hire a full-time
engineer working on automation in the Coq proof assistant (which is
written in Ocaml). We're very interested in candidates with strong
Ocaml background especially in topics related to automated theorem
proving, e.g. SAT/SMT solvers, datalog, superposition, resolution,
etc. While Coq experience is great, you do not need to be a Coq expert
to apply to this position, we're happy to marry your Ocaml expertise
with our Coq expertise.
Formal methods are at the core of BedRock's business and we are deeply
committed to solving problems of system verification at industrial
scale. We get FM techniques and insights into the code early on and
use them to build, maintain, and evolve code. This includes developing
more agile techniques to keep evolving verified systems once they're
built.
We have eight folks on the formal methods team today, hailing from
MPI-SWS, MIT CSAIL, Princeton, and other leading research groups. If
you're interested, send me an email or you can inquire more broadly at
jobs@bedrocksystems.com.
*Company overview:*
BedRock is building a *trustworthy compute base for mission-critical
applications* . The foundation of the platform is an open source,
multi-core, capability-based micro-hypervisor that we are developing
and verifying. On top of these deep specifications we are writing and
verifying applications to provide an extensible and configurable core.
Our contention is that the *time is ripe for verifiably trustworthy
systems*, for everything from secure phones and industrial IoT to
autonomous systems and financial infrastructure. With significant seed
funding, great investors, and commercial projects underway, we are
growing our team in Boston, the Bay Area, DC, and Germany.
ocaml-aws 1.2
═════════════
Archive: <https://discuss.ocaml.org/t/ann-ocaml-aws-1-2/7526/1>
Tim Mc Gilchrist announced
──────────────────────────
I'm pleased to announce the release of [ocaml-aws] 1.2.
ocaml-aws aims to provide generated bindings to many AWS services
using the botocore specifications. In this version we've bumped
version bounds on a bunch of depedencies and also added new bindings
for:
• RDS
• Route53
• SDB
• SQS
Please check it out and report any issues.
[ocaml-aws] <https://opam.ocaml.org/packages/aws/>
Release of `fmlib.0.2.0'
════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-fmlib-0-2-0/7527/1>
Hbr announced
─────────────
I am pleased to announce the second release (0.2.0) of fmlib, a
functional library with managed effects.
The library has up to now 4 components:
• [Some standard datatypes]
• [Pretty printing functions]
• [Parsing combinator library]
• [Primitives to compile to javascript]
The last component is the new one in version 0.2.0. Internally it uses
`js_of_ocaml' to compile to javascript. It is an easy to use library
of primitive functions to access mainly browser functionality from
ocaml and some rudimentary functions to access nodejs functionality.
It can be installed via opam by
┌────
│ opam update
│ opam install fmlib
│ opam install fmlib_js
└────
It is located at [github]
[Some standard datatypes]
<https://hbr.github.io/fmlib/odoc/fmlib/Fmlib_std/index.html>
[Pretty printing functions]
<https://hbr.github.io/fmlib/odoc/fmlib/Fmlib_pretty/Print/index.html>
[Parsing combinator library]
<https://hbr.github.io/fmlib/odoc/fmlib/Fmlib_parse/index.html>
[Primitives to compile to javascript]
<https://hbr.github.io/fmlib/odoc/fmlib_js/index.html>
[github] <https://github.com/hbr/fmlib>
Hbr added
─────────
Hint: `fmlib' is still a bundle of three libraries i.e. three toplevel
modules `Fmlib_std', `Fmlib_pretty' and `Fmlib_parse'. Therefore they
have to be used in a `dune' file with
┌────
│ (libraries fmlib.fmlib_std fmlib.fmlib_pretty fmlib.fmlib_parse ...)
└────
while the new library can be used with
┌────
│ (libraries fmlib_js ...)
└────
This inconvenience will be corrected in the next release.
soupault: a static website generator based on HTML rewriting
════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-soupault-a-static-website-generator-based-on-html-rewriting/4126/14>
Daniil Baturin announced
────────────────────────
[soupault 2.5.0] offers some features that are unique among SSGs.
There are two new built-in widgets for rewriting internal links, which
is useful if you don't host your website at the server root. For
example, if you host it at `example.com/~user', you cannot just write
`<img src="/header.png">': it will point to `example.com/header.png'
while you want `example.com/~user/header.png' instead.
The `relative_links' widget will convert all internal links to
relative links according to their depth in the directory tree. For
example, suppose you have `<img src="/header.png">' in your page
template. Then in `about/index.html' that link will become `<img
src="../header.png">'; in `books/magnetic-fields/index.html' it will
be `<img src="../../header.png">' and so on. This way you can move the
website to a subdirectory and it will still work.
The `absolute_links' widget prepends a prefix to every internal
link. Conceptually similar to the site URL option in other SSGs and
CMSes, but works for all links, not only links generated by the SSG
itself.
[soupault 2.5.0] <https://soupault.app/blog/soupault-2.5.0-release/>
Timere-parse 0.0.2, natural language parsing of date, time and duration
═══════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-timere-parse-0-0-2-natural-language-parsing-of-date-time-and-duration/7532/1>
Darren announced
────────────────
I'm happy to announce the release of Timere-parse 0.0.2, the natural
language parsing component of Timere, a date time handling and
reasoning library. Both packages are under the [Timere repo].
Timere-parse allows interpretation of common descriptions of date,
time and duration.
[Timere repo] <https://github.com/daypack-dev/timere>
Date time examples
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Input strings are in `""', indented lines are pretty printed output.
┌────
│ "2020 jun 6 10am"
│ Ok 2020-06-06T10:00:00Z
│ "2020 jun 6th 10:15"
│ Ok 2020-06-06T10:15:00Z
│ "Australia/Sydney 2020 jun 6 10am"
│ Ok 2020-06-06T10:00:00+10:00
│ "01-06-2020 10:10"
│ Ok 2020-06-01T10:10:00Z
│ "2020/06/01 10am"
│ Ok 2020-06-01T10:00:00Z
│ "jul 6 2021 9:15am"
│ Ok 2021-07-06T09:15:00Z
│ "2020/06/01"
│ Ok 2020-06-01T00:00:00Z
└────
Duration examples
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ "24h"
│ Ok 1 days 0 hours 0 mins 0 secs
│ "16.5 hours"
│ Ok 16 hours 30 mins 0 secs
│ "1h20min"
│ Ok 1 hours 20 mins 0 secs
│ "1 hour 2.5 minutes"
│ Ok 1 hours 2 mins 30 secs
│ "100 seconds"
│ Ok 1 mins 40 secs
│ "2.25 minutes 1 seconds"
│ Ok 2 mins 16 secs
│ "5 days 6.5 hours"
│ Ok 5 days 6 hours 30 mins 0 secs
└────
Timere object examples
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ "2020 jun"
│ Ok (pattern (years 2020) (months Jun))
│ "jan"
│ Ok (pattern (months Jan))
│ jan 6 12pm to 2pm"
│ Ok (bounded_intervals whole (duration 366 0 0 0) (points (pick mdhms Jan 6 12 0 0)) (points (pick hms 14 0 0)))
│ "12th, 13 to 15, 20"
│ Ok (pattern (month_days 12 13 14 15 20))
│ "16th 7:30am"
│ Ok (pattern (month_days 16) (hours 7) (minutes 30) (seconds 0))
│ "16th 8am to 10am, 11am to 12pm"
│ Ok (inter (pattern (month_days 16)) (union (bounded_intervals whole (duration 1 0 0 0) (points (pick hms 8 0 0))
│ (points (pick hms 10 0 0))) (bounded_intervals whole (duration 1 0 0 0) (points (pick hms 11 0 0)) (points (pick hms
│ 12 0 0)))))
│ "2020 jun 16th 10am to jul 1 12pm"
│ Ok (bounded_intervals whole (duration 366 0 0 0) (points (pick ymdhms 2020 Jun 16 10 0 0)) (points (pick mdhms Jul
│ 1 12 0 0)))
└────
Corpus
╌╌╌╌╌╌
For the full corpus/examples, see [corpus/] for code and
[corpus-outputs/] for generated outputs.
[corpus/] <https://github.com/daypack-dev/timere/tree/main/corpus>
[corpus-outputs/]
<https://github.com/daypack-dev/timere/blob/main/corpus-outputs>
ocamlnet-4.1.9
══════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2021-03/msg00028.html>
Gerd Stolpmann announced
────────────────────────
there is now ocamlnet-4.1.9 available:
• compatibility with upcoming OCaml-4.12
• some fixes regarding TLS (https)
• a few build-related details
See the project page for download, documentation, a detailed
changelog, and the mailing list:
<http://projects.camlcity.org/projects/ocamlnet.html>
The repository is at
<https://gitlab.com/gerdstolpmann/lib-ocamlnet3/>
opam follows soon.
Release of cohttp 4.0.0
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-cohttp-4-0-0/7537/1>
Marcello Seri announced
───────────────────────
We are glad to announce the [upcoming release] of [`cohttp 4.0.0'], a
low-level OCaml library for HTTP clients and servers.
This release comes with a big update of the documentation and the
examples, both in the [README] and in the codebase, and improvements
and bug fixes from many contributors 🙇 which you will find listed
below.
A huge thank you to all the people that helped to get this release
ready by raising issues, participating in discussions, sending PRs,
and otherwise using our library.
[upcoming release] <https://github.com/ocaml/opam-repository/pull/18385>
[`cohttp 4.0.0'] <https://github.com/mirage/ocaml-cohttp>
[README] <https://github.com/mirage/ocaml-cohttp>
The future of cohttp
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
To quote @avsm from [another post]
The development process […] is driven by a simple
principle that is inspired by OCaml itself: don't
needlessly break backwards compatibility without good
reason, and when it is necessary, justify it. Our tools
are embedded in projects that have lifespans measured in
the decades, and we take compatibility seriously. That’s
why we take pains to provide migration paths […] that are
as invisible as possible.
Since in this release we have decided to include a number of fixes and
improvements which modified Cohttp module signatures, we decided to
signal the potential breackage by bumping the major version of the
library. In most cases, however, you don't need to do anything and
your code will keep working with the latest cohttp.
Moving forward, we have agreed to start working on the API and the
internals of cohttp to modernize it and get it ready for multicore
support and also for eventual unification with the h2 stack that
offers HTTP2/3 support.
To be able to move forward and avoid stalling improvements for months,
we will be less shy of major releases. However, to remain true to the
principle above, we will be careful to introduce one breakage at a
time, carefully justify its need and provide a clear upgrade path in
the changelog.
The version history is:
• cohttp 2.5.5: security backports (changelog below)
• cohttp 3.0.0: skipped (explained below)
• cohttp 4.0.0: the next release (changelog below)
• cohttp 5.0.0: will include a long-awaited change in [how headers are
treated]: which fixes a multitude of past issues and simplifies the
internals of the module.
For the people that need stability, *we have decided to keep
backporting important security fixes to the `2.5.x' branch of the
project*. In fact, `cohttp 2.5.5', released just a few days ago was
the first release with the backport of a security issue.
[another post]
<https://discuss.ocaml.org/t/defining-standard-ocaml-development-lifecycle-processes/7486/5>
[how headers are treated]
<https://github.com/mirage/ocaml-cohttp/pull/747>
What happened to 3.0.0?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The release of `cohttp 3.0.0' has been long awaited, and we are
extremely grateful to @dinosaure for the enormous work that went into
designing and implementing `conduit 3.0.0' and `cohttp 3.0.0' (part of
which remained in `4.0.0' as bug fixes and API improvements).
However, a discussion started soon after the release pointing out that
there could be further room of improvement also with the new design,
particularly with respect to backwards compatibility. Since the design
discussion did not reach consensus, these changes were reverted to
preserve better compatibility with existing cohttp users and `cohttp
3.0.0' was [marked as unavailable] on the opam repository. As
maintainers, our "lesson learnt" is to not do releases incrementally
when they span multiple libraries: we were caught in an awkward spot
when conduit 3 was released, but without cohttp 3.
The work on the new conduit is steadily progressing and will be
integrated in a new major release of cohttp in the future, once we
will be confident that the API is settled. If you want to try using it
immediately, then it is available as the [mimic] library in ocaml-git.
[marked as unavailable]
<https://github.com/mirage/ocaml-cohttp/issues/736>
[mimic] <https://github.com/mirage/ocaml-git/tree/master/src/mimic>
Change Log
╌╌╌╌╌╌╌╌╌╌
v4.0.0
┄┄┄┄┄┄
• cohttp.response: fix malformed status header for custom status codes
(@mseri @aalekseyev #752)
• remove dependency to base (@samoht #745)
• add GitHub Actions workflow (@smorimoto #739)
• `cohttp-lwt-jsoo': Forward exceptions to caller when response is
null (@mefyl #738)
• Use implicit executable dependency for generate.exe (@TheLortex
#735)
• cohttp: update HTTP codes (@emillon #711)
• cohttp: fix chunked encoding of empty body (@mefyl #715)
• cohttp-async: fix body not being uploaded with unchunked Async.Pipe
(@mefyl #706)
• cohttp-{async, lwt}: fix suprising behaviours of Body.is_empty
(@anuragsoni #714 #712 #713)
• refactoring of tests (@mseri #709, @dinosaure #692)
• update documentation (@dinosaure #716, @mseri #720)
• fix deadlock in logging (@dinosaure #722)
• improve media type parsing (@seliopou #542, @dinosaure #725)
• [reverted] breaking changes to client and server API to use conduit
3.0.0 (@dinosaure #692). However, as the design discussion did not
reach consensus, these changes were reverted to preserve better
compatibility with existing cohttp users. (#741, @samoht)
*Potentially breaking changes*
• remove `wrapped false' from the codebase (@rgrinberg #734)
• cohttp: add Uti.t to uri scheme (@brendanlong #707)
• cohttp-lwt-jsoo: rename Cohttp_lwt_xhr to Cohttp_lwt_jsoo for
consistency (@mseri #717)
• cohttp: fix transfer-encoding ordering in headers (@mseri #721)
• lower-level support for long-running cohttp-async connections
(@brendanlong #704)
• add of_form and to_form functions to body (@seliopou #440, @mseri
#723)
• cohttp-lwt: partly inline read_response, fix body stream leak
(@madroach @dinosaure #696). Note: there is a new warning that may
show up in your logs when bodies are leaked, see also [#730].
• add comparison functions for Request.t and Response.t via
ppx_compare (@msaffer-js @dinosaure #686)
[#730] <https://github.com/mirage/ocaml-cohttp/issues/730>
v2.5.5
┄┄┄┄┄┄
• `Cohttp_async.resolve_local_file', `Cohttp_lwt.resolve_local_file'
and `Cohttp_lwt_unix.resolve_file' are now the same code under the
hood (`Cohttp.Path.resolve_local_file'). The old names have been
preserved for compatibility, but will be marked as deprecated in the
next release. This changes the behavior of
`Cohttp_lwt_unix.resolve_file': it now percent-decodes the paths and
blocks escaping from the docroot correctly. This also fixes and
tests the corner cases in these methods when the docroot is
empty. (@ewanmellor #755)
*Double check your code base for uses of
`Cohttp_lwt_unix.resolve_file': it is unsafe with respect to path
handling*. If you cannot upgrade to `cohttp 2.5.5', you should
modify your code to call `Cohttp_lwt.resolve_local_file' instead.
New Try-Alt-Ergo website
════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-new-try-alt-ergo-website/7555/1>
OCamlPro announced
──────────────────
We are pleased to announce the new version of the [Try Alt-Ergo
website]!
As a reminder, Try Alt-Ergo allows you to write and run your problems
in your browser without any server computation. It was designed to be
a powerful and simple tool to use.
Updates concern these parts of the site:
• A new back end in JavaScript
• Front end with news features (Ace editor, top panel, right panel,
etc.)
Take a look at [our blogpost] to read how we have updated the Try
Alt-Ergo website and what's new! You can also visit the [Try Alt-Ergo
website] directly. As usual, do not hesitate to report bugs, to ask
questions, or to give your feedback.
[Try Alt-Ergo website] <https://try-alt-ergo.ocamlpro.com/>
[our blogpost] <https://www.ocamlpro.com/2021/03/29/new-try-alt-ergo/>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [New Try-Alt-Ergo]
• [TZComet's New Token Viewer]
[OCaml Planet] <http://ocaml.org/community/planet/>
[New Try-Alt-Ergo]
<https://www.ocamlpro.com/2021/03/29/new-try-alt-ergo/>
[TZComet's New Token Viewer]
<https://seb.mondet.org/b/0012-tzcomet-token-viewer.html>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 35049 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-03-23 9:05 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-03-23 9:05 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 7202 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 16 to 23,
2021.
Table of Contents
─────────────────
findlib-1.9.1
Conformist 0.2.1
Compiler Explorer now supports OCaml 4.12.0
Annoucement of OFLAT, a web-based platform to support courses on Formal Languages and Automata Theory
Old CWN
findlib-1.9.1
═════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2021-03/msg00014.html>
Gerd Stolpmann announced
────────────────────────
a couple of installation problems slipped into findlib-1.9, mostly
missing files in the release tarball, but also a FreeBSD
incompatibility. For that reason, there is now findlib-1.9.1 fixing
the problems (so far known, and I hope we caught them all).
Same link as before:
<http://projects.camlcity.org/projects/findlib.html>
Conformist 0.2.1
════════════════
Archive: <https://discuss.ocaml.org/t/ann-conformist-0-2-1/7482/1>
jerben announced
────────────────
I am happy to announce the release of conformist 0.2.1.
[Conformist] deals with schema definition and validation. It supports
decoding to bridge the gap between runtime types and static types
without ppx.
┌────
│ type occupation =
│ | Mathematician
│ | Engineer
│
│ type user =
│ { occupation : occupation
│ ; email : string
│ ; birthday : int * int * int
│ ; nr_of_siblings : int
│ ; comment : string option
│ ; wants_premium : bool
│ }
│
│ let user occupation email birthday nr_of_siblings comment wants_premium =
│ { occupation; email; birthday; nr_of_siblings; comment; wants_premium }
│ ;;
│
│ let occupation_decoder = function
│ | "mathematician" -> Ok Mathematician
│ | "engineer" -> Ok Engineer
│ | _ -> Error "Unknown occupation provided"
│ ;;
│
│ let occupation_encoder = function
│ | Mathematician -> "mathematician"
│ | Engineer -> "engineer"
│ ;;
│
│ let user_schema =
│ Conformist.(
│ make
│ Field.
│ [ custom
│ occupation_decoder
│ occupation_encoder
│ "occupation"
│ ~meta:()
│ ; string "email"
│ ; date "birthday"
│ ; int ~default:0 "nr_of_siblings"
│ ; optional (string "comment")
│ ; bool "wants_premium"
│ ]
│ user)
│ ;;
│
│ let input =
│ [ "occupation", [ "engineer" ]
│ ; "email", [ "test@example.com" ]
│ ; "birthday", [ "2020-12-01" ]
│ ; "nr_of_siblings", [ "3" ]
│ ; "comment", [ "hello" ]
│ ; "wants_premium", [ "true" ]
│ ]
│
│ let user =
│ Conformist.decode Schema.user_schema input
│
│ let validation_errors =
│ Conformist.validate Schema.user_schema input
└────
The `user_schema' and the `user' create function are guaranteed to be
in sync at compile time.
[Conformist] <https://github.com/oxidizing/conformist>
Compiler Explorer now supports OCaml 4.12.0
═══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-compiler-explorer-now-supports-ocaml-4-12-0/7479/3>
Continuing this thread, Sora Morimoto announced
───────────────────────────────────────────────
Today we deployed 4.12.0 flambda. It must already be available!
Annoucement of OFLAT, a web-based platform to support courses on Formal Languages and Automata Theory
═════════════════════════════════════════════════════════════════════════════════════════════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2021-03/msg00026.html>
Antonio Ravara announced
────────────────────────
<http://ctp.di.fct.unl.pt/FACTOR/OFLAT/>
To support students’ autonomous work on topics related with Formal
Languages and Automata Theory (FLAT), interactive tools that allow
them to experiment with examples and solve exercises are very
important - several studies demonstrate this.
There are applications with this aim. While some are impressively
complete, but are mainly Desktop applications (like JFLAP), others
that can be used via a web browser are under-developed. Moreover,
these applications are often not fully interactive - illustrations or
even step-by-step execution is key to understand the algorithms - and,
due to the programming languages used, implement the concepts in a way
quite distant from the textbook Mathematical definitions. Code that
implements closely the definitions is also a relevant pedagogical
tool.
With three concerns in mind - availability in mobile devices,
interactive run of the algorithms (or at least presenting clear
explanations), and code following closely the definitions - we
developed OFLAT, a web-based tool to represent and illustrate
graphically classical mechanisms and algorithms of Formal Languages
and Automata Theory. It includes not only exercises evaluated
automatically and providing feedback, but also allows students to
create their own exercises. An integration with a grading platform
like Learn-OCaml is underway.
The tool is implemented in OCaml and is organised in two parts: a
library - OCamlFLAT - which concentrates the logic of FLAT concepts,
and the interactive applicational part - OFLAT. To run on browsers,
the application uses the OCaml to Javascript translator
Js_of_OCaml. To implement the interactive graphics, it uses Cytoscape,
a Javascript library for graphs. All code is available in the Git of
the project: <https://gitlab.com/releaselab/leaf/OCamlFlat>,
<https://gitlab.com/releaselab/leaf/OFLAT>.
The development of new functionalities is ongoing (we're now working
more animations and on Context-Free Grammar and Pushdown Automata).
Comments most welcome.
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 21239 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-03-16 10:31 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-03-16 10:31 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 5376 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 09 to 16,
2021.
Table of Contents
─────────────────
Links from the OCaml Discourse
findlib-1.9
Compiler Explorer now supports OCaml 4.12.0
Old CWN
Links from the OCaml Discourse
══════════════════════════════
The editor says
───────────────
Due to a [global Discourse change] that disabled the mailing list
mode, I was no able to collect the bodies of the news from the OCaml
Discourse for several days. This has now been fixed and next week’s
OCaml Weekly News should be as usual. In the meantime, here are links
to the main announcements. Do not hesitate to [contact me] if you want
to give feedback about this newsletter.
• [Release 1.0.0 of bag]
• [Plan for Dune 3.0]
• [lascar 0.7.0 - a library for manipulating Labeled Transition
Systems in OCaml]
• [dirsift 0.0.3 - Search for directories by type]
• [FSML 0.3.0 - an OCaml library for describing and describing
synchronous finite state machines]
• [Multicore OCaml: February 2021]
• [VSCode OCaml Platform v1.7.0 - v1.8.0]
• [ca-certs and ca-certs-nss]
• [Js_of_Ocaml position at TrustInSoft]
• [Senior Developer vacancy at Cryptosense, France (or remote)]
• [hxd.0.3.1 - A simple hexdump tool in OCaml]
• [Release of Gopcaml-mode (0.0.2) - Unicode & Compatibility Update]
[global Discourse change]
<https://meta.discourse.org/t/mailing-list-mode-mysteriously-deactivated/182650>
[contact me] <mailto:alan.schmitt@polytechnique.org>
[Release 1.0.0 of bag]
<https://discuss.ocaml.org/t/ann-release-1-0-0-of-bag/7464>
[Plan for Dune 3.0] <https://discuss.ocaml.org/t/plan-for-dune-3-0/7414>
[lascar 0.7.0 - a library for manipulating Labeled Transition Systems in
OCaml]
<https://discuss.ocaml.org/t/ann-lascar-0-7-0-a-library-for-manipulating-labeled-transition-systems-in-ocaml/7443>
[dirsift 0.0.3 - Search for directories by type]
<https://discuss.ocaml.org/t/ann-dirsift-0-0-3-search-for-directories-by-type/7435>
[FSML 0.3.0 - an OCaml library for describing and describing synchronous
finite state machines]
<https://discuss.ocaml.org/t/ann-fsml-0-3-0-an-ocaml-library-for-describing-and-describing-synchronous-finite-state-machines/7445>
[Multicore OCaml: February 2021]
<https://discuss.ocaml.org/t/multicore-ocaml-february-2021/7449>
[VSCode OCaml Platform v1.7.0 - v1.8.0]
<https://discuss.ocaml.org/t/ann-vscode-ocaml-platform-v1-7-0-v1-8-0/7424>
[ca-certs and ca-certs-nss]
<https://discuss.ocaml.org/t/ann-ca-certs-and-ca-certs-nss/6804/7>
[Js_of_Ocaml position at TrustInSoft]
<https://discuss.ocaml.org/t/js-of-ocaml-position-at-trustinsoft/7429>
[Senior Developer vacancy at Cryptosense, France (or remote)]
<https://discuss.ocaml.org/t/senior-developer-vacancy-at-cryptosense-france-or-remote/7431>
[hxd.0.3.1 - A simple hexdump tool in OCaml]
<https://discuss.ocaml.org/t/ann-hxd-0-3-1-a-simple-hexdump-tool-in-ocaml/7417>
[Release of Gopcaml-mode (0.0.2) - Unicode & Compatibility Update]
<https://discuss.ocaml.org/t/ann-release-of-gopcaml-mode-0-0-2-unicode-compatibility-update/7425>
findlib-1.9
═══════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2021-03/msg00012.html>
Gerd Stolpmann announced
────────────────────────
findlib-1.9 is out. Changes:
• Overhaul how separately installed packages (e.g. num) are handled
(by David Allsopp).
• Switch to opam-2.0 file format (by David Allsopp).
• Fix an incomaptibility with ocaml-4.13 (by David Allsopp).
• Expose the native toplevel (by Louis Gesbert).
• Fix an incompatibility with "Jane Street Style" (by Mark Laws).
• Switch from m4 to sed (by kit-ty-kate).
For manual, download, manuals, etc. see here:
<http://projects.camlcity.org/projects/findlib.html>
An updated OPAM package will follow soon.
Compiler Explorer now supports OCaml 4.12.0
═══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-compiler-explorer-now-supports-ocaml-4-12-0/7479/1>
Sora Morimoto announced
───────────────────────
Sorry to the OCaml hacker using Compiler Explorer for the late update
(it took some time to deploy the infrastructure, etc.), but it now
supports OCaml 4.12.0, but also 4.10.2 and 4.11.2!
<https://godbolt.org>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 16008 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-03-09 10:58 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-03-09 10:58 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 10261 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 02 to 09,
2021.
Table of Contents
─────────────────
Working on an app to learn and execute OCaml on iPhone/iPad/Mac for beginners
ERic (Entity-Relation interactive calculator) version 0.3
OCaml Café: Tue, March 9 @ 7-9pm (CST)
Functional Programming User Study (Specifically in OCaml)
OCaml 4.12.0 released (with 4.11.2 too)
Other OCaml News
Old CWN
Working on an app to learn and execute OCaml on iPhone/iPad/Mac for beginners
═════════════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/working-on-an-app-to-learn-and-execute-ocaml-on-iphone-ipad-mac-for-beginners/7392/1>
Nathan Fallet announced
───────────────────────
I started to work on a new project recently: My goal is to provide an
iOS app for beginners to learn OCaml and practice on their device. I
think it is a good idea to get started easily.
Here are some screenshots of what I’ve done so far:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/e/ef66cf62d1ab605542033f09040cc964787cbb65_2_462x1000.jpeg>
I’m open to feedback and opinion about this project idea
Nathan Fallet then added
────────────────────────
I made it available for pre order on the App Store - I will keep
improving it with time, and I think it can be a great tool for
beginners
[https://apps.apple.com/app/ocaml-learn-code/id1547506826]
[https://apps.apple.com/app/ocaml-learn-code/id1547506826]
<https://apps.apple.com/app/ocaml-learn-code/id1547506826>
Yawar Amin replied
──────────────────
This is really cool. I just want to point out that your app is the
sole search result for 'OCaml' in the App Store. So that's a first
:-)
Incidentally, there is an 'OCaml Toplevel' app on the Android Play
Store:
<https://play.google.com/store/apps/details?id=fr.vernoux.ocaml>
Your app looks more sophisticated though. Hopefully one day we have
something like [Swift Playgrounds] and people can start learning OCaml
interactively on their devices directly.
[Swift Playgrounds] <https://www.apple.com/ca/swift/playgrounds/>
ERic (Entity-Relation interactive calculator) version 0.3
═════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-eric-entity-relation-interactive-calculator-version-0-3/7408/1>
Damien Guichard announced
─────────────────────────
The [programming languages zoo] is a great resource for wanna-be
interpreter/compiler writers. The [ICFP 2000 programming contest] is
another great resource for wanna-be ray tracers. However until now
there has been no OCaml resource for wanna-be Knowledge Representation
tool-ers. This makes sound like KR tool is a more difficult area than
other projects. ERic v0.3 demonstrates the opposite as it's about 1200
lines size (lexer & hand-written parser included) and reads/writes a
[Conceptual Graph] Interchange Format (CGIF) notation.
• ERic v0.3 [Zip archive]
• ERic v0.3 [SVN repository]
[programming languages zoo] <http://plzoo.andrej.com/>
[ICFP 2000 programming contest]
<https://www.cs.cornell.edu/icfp/contest_results.htm>
[Conceptual Graph] <https://en.wikipedia.org/wiki/Conceptual_graph>
[Zip archive]
<http://damien-guichard.developpez.com/downloads/ERic-0.3.zip>
[SVN repository] <http://subversion.developpez.com/projets/ERic/trunk/>
OCaml Café: Tue, March 9 @ 7-9pm (CST)
══════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-cafe-tue-march-9-7-9pm-cst/7409/1>
Claude Jager-Rubinson announced
───────────────────────────────
Please join us next Tuesday at 7pm Central time for the second meeting
of OCaml Café. Zoom connection info is available at [Houston
Functional Programmers].
OCaml Café offers a friendly, low stakes opportunity to ask questions
about the OCaml language and ecosystem, work through programming
problems that you’re stuck on, and get feedback on your code.
Especially geared toward new and intermediate users, experienced OCaml
developers will be available to answer your questions.
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 with your questions about OCaml, or just to hang out with the OCaml
community.
[Houston Functional Programmers] <https://hfpug.org>
Functional Programming User Study (Specifically in OCaml)
═════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/functional-programming-user-study-specifically-in-ocaml/7410/1>
Ahan Malhotra announced
───────────────────────
We are doing user studies to help us understand how to help people
understand and navigate complex information about programming
documentation, *specifically in OCaml*. You will complete a series
tasks that help us understand working memory and how you navigate a
new interface. After examining a layout of the data (interface) for a
short, predetermined amount of time, you will be asked a set of
comprehension and/or qualitative questions to measure whether the
methods of presenting this information has any impact on your
performance.
*The study will take around 55 minutes, and you will be entered into a
lottery for a $150 Amazon gift card as compensation for your time.*
*A bit more about this study*
The user study will be done virtually on Zoom. You will be asked to
various tasks with the interface. The interface is deployed as a
public web application so you don’t have to install anything. This
research is governed by Harvard University's Committee on the Use of
Human Subjects.
*Eligibility*
You also don’t have to be an expert in anything to participate. You
just need to be fluent in English and over 18 years of age.
If you are interested, please fill out this survey to confirm your
eligibility, and we will follow up to schedule the study session:
<https://forms.gle/q6vkyEE2tSjjZoiSA>
If you have any questions, please email
ahanmalhotra@college.harvard.edu.
OCaml 4.12.0 released (with 4.11.2 too)
═══════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-4-12-0-released-with-4-11-2-too/7358/13>
Continuing this thread from last week, Hannes Mehnert said
──────────────────────────────────────────────────────────
Congratulations to the new release. For the curious who intend to
install a flambda version of 4.12 and are surprised that
`ocaml-variants.4.12.0+flambda' does not exist, from [this thread] the
opam layout has changed, and now the following works:
┌────
│ $ opam sw create <my-switch-name> --packages=ocaml-variants.4.12.0+options,ocaml-options-only-flambda
└────
There are more configuration options available, take a look at the
output of `opam search ocaml-option' for all options. (I've not been
involved with this development. I don't quite understand why there is
for each `Y' a `ocaml-option-Y' and a `ocaml-options-only-Y'.) I also
have not figured out whether there's a way to pass `-O3' in the just
created switch.
Maybe it is worth to embed such information in the very nicely styled
OCaml manual (considering that opam got quite some traction over the
years and is recommended for OCaml developers)?
[this thread]
<https://discuss.ocaml.org/t/ocaml-4-12-0-first-release-candidate/7294>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Release of Frama-Clang 0.0.10]
• [Qubes-lite with KVM and Wayland]
• [Florence and beyond: the future of Tezos storage]
• [The ReScript Association]
[OCaml Planet] <http://ocaml.org/community/planet/>
[Release of Frama-Clang 0.0.10]
<https://frama-c.com/fc-plugins/frama-clang.html>
[Qubes-lite with KVM and Wayland]
<https://roscidus.com/blog/blog/2021/03/07/qubes-lite-with-kvm-and-wayland/>
[Florence and beyond: the future of Tezos storage]
<https://tarides.com/blog/2021-03-04-florence-and-beyond-the-future-of-tezos-storage>
[The ReScript Association]
<https://rescript-lang.org/blog/rescript-association-rebranding>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 21846 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-02-23 9:51 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-02-23 9:51 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 15261 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of February 16 to 23,
2021.
Table of Contents
─────────────────
OCamlFormat 0.17.0
Set up OCaml 1.1.8
Set up OCaml 1.1.9
OCaml 4.12.0, first release candidate
Ppxlib.0.22: an update on the state of ppx
OCaml-based trading firm is hiring remote devs
ocamlearlybird 1.0.0 beta1
OCaml for ARM MacOS
Old CWN
OCamlFormat 0.17.0
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-ocamlformat-0-17-0/7287/1>
Guillaume Petiot announced
──────────────────────────
On behalf of the OCamlFormat development team I am pleased to announce
the release of [ocamlformat.0.17.0] :tada:.
OCamlformat is an auto-formatter for OCaml code, writing the parse
tree and comments in a consistent style, so that you do not have to
worry about formatting it by hand, and to speed up code review by
focusing on the important parts.
OCamlFormat is beta software. We expect the program to change
considerably before we reach version 1.0.0. In particular, upgrading
the `ocamlformat' package will cause your program to get
reformatted. Sometimes it is relatively pain-free, but sometimes it
will make a diff in almost every file. We are working towards having a
tool that pleases most usecases in the OCaml community, please bear
with us!
To make sure your project uses the last version of ocamlformat, please
set
┌────
│ version=0.17.0
└────
in your `.ocamlformat' file.
Main changes in `ocamlformat.0.17.0' are:
• the `let-open' option, deprecated since 0.16.0, has been removed
• support for OCaml 4.06 and 4.07 has been removed, minimal version
requirement bumped to OCaml 4.08
• the `extension-sugar' option, deprecated since 0.14.0, has been
removed
• the syntax of infix set/get operators is now preserved (`String.get'
and similar calls used to be automatically rewritten to their
corresponding infix form `.()', that was incorrect when using the
`-unsafe' compilation flag. Now the concrete syntax of these calls
is preserved)
• all sugared extension points are now preserved
• injectivity type annotations (OCaml 4.12 feature) are now supported
• various fixes about comments positions
We encourage you to try ocamlformat, that can be installed from opam
directly ( `opam install ocamlformat' ), but please remember that it
is still beta software. We have a [FAQ for new users ] that should
help you decide if ocamlformat is the right choice for you.
[ocamlformat.0.17.0] <https://github.com/ocaml-ppx/ocamlformat>
[FAQ for new users ]
<https://github.com/ocaml-ppx/ocamlformat#faq-for-new-users>
Set up OCaml 1.1.8
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-8/7288/1>
Sora Morimoto announced
───────────────────────
Changed
╌╌╌╌╌╌╌
• The Windows opam wrapper is fractionally less-archaically named
opam.cmd, with no loss in arcaneness.
• Export `CYGWIN_ROOT' on the Windows runners, allowing bash to be
invoked as `%CYGWIN_ROOT%\bin\bash~/~$env:CYGWIN_ROOT\bin\bash' (and
similarly for Cygwin `setup-x86_64.exe').
• The Windows runner no longer prepends `%CYGWIN_ROOT%\bin' to `PATH'.
Fixed
╌╌╌╌╌
• Switches in Unix are now properly initialized before running depext.
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.8>
Set up OCaml 1.1.9
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-9/7293/1>
Sora Morimoto announced
───────────────────────
Fixed
╌╌╌╌╌
• Further fix to switch initialisation.
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.9>
OCaml 4.12.0, first release candidate
═════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-4-12-0-first-release-candidate/7294/1>
octachron announced
───────────────────
The release of OCaml 4.12.0 is expected next week. We have created a
release candidate that you can test. Most opam packages should work
with this release candidate (without the need for an alpha
repository).
Compared to the last beta, this new release only contains one fix for
Solaris and illumos.
If you find any bugs, please report them here:
<https://github.com/ocaml/ocaml/issues>
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~rc1 --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 <switch_name> --packages=ocaml-variants.4.12.0~rc1+options,<option_list>
│ --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where `<option_list>' is a comma separated list of ocaml-option-*
packages. For instance, for a flambda and afl enabled switch:
┌────
│ opam switch create 4.12.0~rc1+flambda+afl --packages=ocaml-variants.4.12.0~rc1+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:
• <https://github.com/ocaml/ocaml/archive/4.12.0-rc1.tar.gz>
• <https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.0~rc1.tar.gz>
Ppxlib.0.22: an update on the state of ppx
══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ppxlib-0-22-an-update-on-the-state-of-ppx/7296/1>
Nathan Rebours announced
────────────────────────
We're happy to announce the release of ppxlib.0.22.0, the fist release
of ppxlib fully compatible with OCaml 4.12. The main and only feature
of this release is the bump of the internal OCaml AST used by ppxlib
from 4.11 to 4.12, allowing you to use 4.12 language features with
ppxlib and any ppxlib-based ppx. Note that ppxlib was compatible with
the 4.12 compiler since 0.19.0 but that you couldn't use 4.12 language
features until now.
This is the third such AST bump release since we announced our plan to
improve the state of the PPX ecosystem [here] and we though it'd be a
good time to report back to you and tell you how things are going on
this front.
For those of you who aren't familiar with this plan, the goal is to
upstream a minimal, stable, ocaml-migrate-parsetree-like API on top of
the compiler-libs called `Astlib'. It will allow us to keep ppxlib and
any ppx based on ppxlib compatible with OCaml trunk at all time. To
allow better performances and a clear compisition semantic, all the
ppxlib-based ppx-es need to use the same AST (as opposed to
ocaml-migrate-parsetree based ppx-es) so from a certain perspective,
this plan simply moves the breaking API up one step, from
compiler-libs to ppxlib. In order to greatly ease the maintainenance
of ppx-es and to prevent opam-universe splits we decided that
everytime we cut a breaking ppxlib release, we will send patches to
keep the existing ppx-es compatible with the latest version and
therefore with the latest OCaml compilers and language features.
While this seems like a tremendous task and a huge amount of work,
dune and other tools that raised in its wake such as [opam-monorepo]
incredibly simplified this kind of work.
Ahead of OCaml releases, we prepare a branch of ppxlib with the
upgraded AST. We then fetch opam-repository to gather a list of
sensible reverse dependencies (i.e. packages whose latest version
depends on ppxlib and is compatible with ppxlib's latest version) and
assemble a dune workspace with a clone of each of those reverse
dependencies, our ppxlib branch and all of their dependencies thanks
to opam-monorepo. We then use dune to build all the packages we're
interested in and simply follow the compilation errors until
everything builds successfully with the new ppxlib. What remains is
to create PRs on the relevant repositories to upstream those changes,
after which maintainers have everything they need to cut a new
compatible release.
Most of this process is automated using scripts but it still requires
a bit of handiwork. We aim at extracting tools to further improve this
workflow and reduce the time and effort required but it has been
surprisingly smooth. Our experience with the 4.10, 4.11 and 4.12
upgrades so far is that most reverse dependencies don't need an
upgrade and that it's far less demanding for one person to upgrade all
the packages that need it than it would be for each individual
maintainers to understand the changes in the AST and do the upgrade
themselves.
It's worth noting that for this to work well, the ppx-es and all their
dependencies have to build with dune. We do maitain a separate
opam-repository with dune ports of commonly used packages so in
practice most projects fall into this category but a few exceptions
remain and they are therefore not taken into account for this upgrade
process.
We're also trying to improve the tracking of the upgrade's progress
and for the 4.12 compatible release we created a [github project] to
have a list of all the packages we considered and see where they
are. We also keep track of the packages we had to exclude and why.
During this upgrade, we considered 80 opam packages, out of which only
4 needed to be patched and 6 had to be excluded from the process as we
couldn't reasonably get them to build in our workspace.
Once we have a better idea of what makes a package easy to upgrade we
plan on releasing a set of reasonable rules to follow to benefit from
those upgrades, we'll keep you updated on this!
All in all we're pretty happy with this new process and although it
needs to be refined, we're confident it can grow into something
sustainable by creating tools and CI to support it. Hopefully these
will also benefit the wider community and help grow a healthier Opam
universe.
[here] <https://discuss.ocaml.org/t/ppx-omp-2-0-0-and-next-steps/6231>
[opam-monorepo] <https://github.com/ocamllabs/opam-monorepo>
[github project] <https://github.com/ocaml-ppx/ppxlib/projects/2>
Jason Nielsen asked
───────────────────
Curious about the current status of `Astlib'. I was closely following
[ppx] at one point but it hasn't seen much activity recently. Thanks
for all your hard work.
[ppx] <https://github.com/ocaml-ppx/ppx>
Jérémie Dimino
──────────────
It's in progress. Not much happened in the past couple of months while
we were finishing the port of a few projects to ppxlib and doing the
4.12 upgrade. But @pitag re-started working `Astlib' as of a week
ago. You can follow our progression via [the public meeting notes].
Note however that the [ppx] project was for our original goal or
providing a "forever stable" API for ppx rewriters. It has been in
pause since August 2020 while were trying the "upgrade the world"
method, which as @NathanReb pointed out is working pretty well
practice. At this point, it's looking more and more likely that we
won't resurect the ppx project.
[the public meeting notes] <https://github.com/ocaml-ppx/ppxlib/wiki>
[ppx] <https://github.com/ocaml-ppx/ppx>
OCaml-based trading firm is hiring remote devs
══════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-based-trading-firm-is-hiring-remote-devs/7298/1>
Michael Bacarella announced
───────────────────────────
BTG is a trading firm founded by ex-Jane Street devs looking to hire
some more devs.
The role is primarily remote, working with the rest of our mostly
remote team, though we hope to resume regular on-sites in Puerto Rico.
We operate 24/7 and will consider employees anywhere in the world.
Prior experience with OCaml is a plus, though any solid programming
experience with an interest in functional programming and strong
static types is also fine.
Comfort navigating Linux is essential.
Shoot me a message with a copy of your résumé or C.V. to discuss the
opportunity further: [michael.bacarella@gmail.com]
Feel free to re-post this elsewhere.
[michael.bacarella@gmail.com] <mailto:michael.bacarella@gmail.com>
ocamlearlybird 1.0.0 beta1
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocamlearlybird-1-0-0-beta1/7180/21>
文宇祥 announced
────────────────
Hi, all. All the issues of beta1 have been fixed. Beta2 will be
released soon.
<https://github.com/ocaml/opam-repository/pull/18191>
OCaml for ARM MacOS
═══════════════════
Archive: <https://discuss.ocaml.org/t/ocaml-for-arm-macos/6019/24>
Aaron L. Zeng announced
───────────────────────
I noticed that opam 2.08 is now available for ARM Macs using
[Homebrew], and I was able to confirm on my machine.
`brew install opam' away :)
[Homebrew] <https://github.com/Homebrew/homebrew-core/pull/71605>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 29081 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-02-16 13:53 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-02-16 13:53 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 18679 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of February 09 to 16,
2021.
Table of Contents
─────────────────
opam 2.0.8 release
opam 2.1.0~beta4
Set up OCaml 1.1.6
Set up OCaml 1.1.7
Old CWN
opam 2.0.8 release
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-opam-2-0-8-release/7242/1>
R. Boujbel announced
────────────────────
We are pleased to announce the minor release of [opam 2.0.8].
This new version contains some fixes, mainly for sandbox and fish
scripts. You can find more information in this [blog post], and more
detailed in the [release note].
/opam is a source-based package manager for OCaml. It supports
multiple simultaneous compiler installations, flexible package
constraints, and a Git-friendly development workflow./
[opam 2.0.8] <https://github.com/ocaml/opam/releases/tag/2.0.8>
[blog post] <https://opam.ocaml.org/blog/opam-2-0-8>
[release note] <https://github.com/ocaml/opam/releases/tag/2.0.8>
opam 2.1.0~beta4
════════════════
Archive: <https://discuss.ocaml.org/t/ann-opam-2-1-0-beta4/7252/1>
David Allsopp announced
───────────────────────
On behalf of the opam team, it gives me great pleasure to announce the
third beta release of opam 2.1. Don’t worry, you didn’t miss beta3 -
we had an issue with a configure script that caused beta2 to report as
beta3 in some instances, so we skipped to beta4 to avoid any further
confusion!
We encourage you to try out this new beta release: there are
instructions for doing so in [our wiki]. The instructions include
taking a backup of your `~/.opam' root as part of the process, which
can be restored in order to wind back. _Please note that local
switches which are written to by opam 2.1 are upgraded and will need
to be rebuilt if you go back to opam 2.0_. This can either be done by
removing `_opam' and repeating whatever you use in your build process
to create the switch, or you can use `opam switch export
switch.export' to backup the switch to a file before installing new
packages. Note that opam 2.1 _shouldn’t_ upgrade a local switch unless
you upgrade the base packages (i.e. the compiler).
[our wiki]
<https://github.com/ocaml/opam/wiki/How-to-test-an-opam-feature>
What’s new in opam 2.1?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Switch invariants
• Improved options configuration (see the new `option' and expanded
`var' sub-commands)
• Integration of system dependencies (formerly the opam-depext
plugin), increasing their reliability as it integrates the solving
step
• Creation of lock files for reproducible installations (formerly the
opam-lock plugin)
• CLI versioning, allowing cleaner deprecations for opam now and also
improvements to semantics in future without breaking
backwards-compatibility
• Performance improvements to opam-update, conflict messages, and many
other areas
• New plugins: opam-compiler and opam-monorepo
Switch invariants
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
In opam 2.0, when a switch is created the packages selected are put
into the “base” of the switch. These packages are not normally
considered for upgrade, in order to ease pressure on opam’s
solver. This was a much bigger concern early on in opam 2.0’s
development, but is less of a problem with the default mccs solver.
However, it’s a problem for system compilers. opam would detect that
your system compiler version had changed, but be unable to upgrade the
ocaml-system package unless you went through a slightly convoluted
process with `--unlock-base'.
In opam 2.1, base packages have been replaced by switch
invariants. The switch invariant is a package formula which must be
satisfied on every upgrade and install. All existing switches’ base
packages could just be expressed as `package1 & package2 & package3'
etc. but opam 2.1 recognises many existing patterns and simplifies
them, so in most cases the invariant will be `"ocaml-base-compiler" {=
4.11.1}', etc. This means that `opam switch create my_switch
ocaml-system' now creates a _switch invariant_ of `"ocaml-system"'
rather than a specific version of the `ocaml-system' package. If your
system OCaml package is updated, `opam upgrade' will seamlessly switch
to the new package.
This also allows you to have switches which automatically install new
point releases of OCaml. For example:
┌────
│ opam switch create ocaml-4.11 --formula='"ocaml-base-compiler" {>= "4.11.0" & < "4.12.0~"}'
│ --repos=old=git+https://github.com/ocaml/opam-repository#a11299d81591
│ opam install utop
└────
Creates a switch with OCaml 4.11.0 (the `--repos=' was just to select
a version of opam-repository from before 4.11.1 was released). Now
issue:
┌────
│ opam repo set-url old git+https://github.com/ocaml/opam-repository
│ opam upgrade
└────
and opam 2.1 will automatically offer to upgrade OCaml 4.11.1 along
with a rebuild of the switch. There’s not yet a clean CLI for
specifying the formula, but we intend to iterate further on this with
future opam releases so that there is an easier way of saying “install
OCaml 4.11.x”.
opam depext integration
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
opam has long included the ability to install system dependencies
automatically via the [depext plugin]. This plugin has been promoted
to a native feature of opam 2.1.0 onwards, giving the following
benefits:
• You no longer have to remember to run `opam depext', opam always
checks depexts (there are options to disable this or automate it for
CI use). Installation of an opam package in a CI system is now as
easy as `opam install .', without having to do the dance of `opam
pin add -n/depext/install'. Just one command now for the common
case!
• The solver is only called once, which both saves time and also
stabilises the behaviour of opam in cases where the solver result is
not stable. It was possible to get one package solution for the
`opam depext' stage and a different solution for the `opam install'
stage, resulting in some depexts missing.
• opam now has full knowledge of depexts, which means that packages
can be automatically selected based on whether a system package is
already installed. For example, if you have *neither* MariaDB nor
MySQL dev libraries installed, `opam install mysql' will offer to
install `conf-mysql' and `mysql', but if you have the MariaDB dev
libraries installed, opam will offer to install `conf-mariadb' and
`mysql'.
[depext plugin] <https://github.com/ocaml-opam/opam-depext>
opam lock files and reproducibility
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
When opam was first released, it had the mission of gathering together
scattered OCaml source code to build a [community repository]. As time
marches on, the size of the opam repository has grown tremendously, to
over 3000 unique packages with over 18000 unique versions. opam looks
at all these packages and is designed to solve for the best
constraints for a given package, so that your project can keep up with
releases of your dependencies.
While this works well for libraries, we need a different strategy for
projects that need to test and ship using a fixed set of
dependencies. To satisfy this use-case, opam 2.0.0 shipped with
support for _using_ `project.opam.locked' files. These are normal opam
files but with exact versions of dependencies. The lock file can be
used as simply as `opam install . --locked' to have a reproducible
package installation.
With opam 2.1.0, the creation of lock files is also now integrated
into the client:
• `opam lock' will create a `.locked' file for your current switch and
project, that you can check into the repository.
• `opam switch create . --locked' can be used by users to reproduce
your dependencies in a fresh switch.
This lets a project simultaneously keep up with the latest
dependencies (without lock files) while providing a stricter set for
projects that need it (with lock files).
[community repository] <https://github.com/ocaml/opam-repository>
CLI Versioning
┄┄┄┄┄┄┄┄┄┄┄┄┄┄
A new `--cli' switch was added to the first beta release, but it’s
only now that it’s being widely used. opam is a complex enough system
that sometimes bug fixes need to change the semantics of some
commands. For example:
• `opam show --file' needed to change behaviour
• The addition of new controls for setting global variables means that
the `opam config' was becoming cluttered and some things want to
move to `opam var'
• `opam switch create 4.11.1' still works in opam 2.0, but it’s really
an OPAM 1.2.2 syntax.
Changing the CLI is exceptionally painful since it can break scripts
and tools which themselves need to drive `opam'. CLI versioning is
our attempt to solve this. The feature is inspired by the `(lang dune
...)' stanza in `dune-project' files which has allowed the Dune
project to rename variables and alter semantics without requiring
every single package using Dune to upgrade their `dune' files on each
release.
Now you can specify which version of opam you expected the command to
be run against. In day-to-day use of opam at the terminal, you
wouldn’t specify it, and you’ll get the latest version of the CLI. For
example: `opam var --global' is the same as `opam var --cli=2.1
--global'. However, if you issue `opam var --cli=2.0 --global', you
will told that `--global' was added in 2.1 and so is not available to
you. You can see similar things with the renaming of `opam upgrade
--unlock-base' to `opam upgrade --update-invariant'.
The intention is that `--cli' should be used in scripts, user guides
(e.g. blog posts), and in software which calls opam. The only decision
you have to take is the _oldest_ version of opam which you need to
support. If your script is using a new opam 2.1 feature (for example
`opam switch create --formula=') then you simply don’t support opam
2.0. If you need to support opam 2.0, then you can’t use `--formula'
and should use `--packages' instead. opam 2.0 does not have the
`--cli' option, so for opam 2.0 instead of `--cli=2.0' you should set
the environment variable `OPAMCLI' to `2.0'. As with _all_ opam
command line switches, `OPAMCLI' is simply the equivalent of `--cli'
which opam 2.1 will pick-up but opam 2.0 will quietly ignore (and, as
with other options, the command line takes precedence over the
environment).
Note that opam 2.1 sets `OPAMCLI=2.0' when building packages, so on
the rare instances where you need to use the `opam' command in a
_package_ `build:' command (or in your build system), you _must_
specify `--cli=2.1' if you’re using new features.
There’s even more detail on this feature [in our wiki]. We’re still
finalising some details on exactly how `opam' behaves when `--cli' is
not given, but we’re hoping that this feature will make it much easier
in future releases for opam to make required changes and improvements
to the CLI without breaking existing set-ups and tools.
[in our wiki]
<https://github.com/ocaml/opam/wiki/Spec-for-opam-CLI-versioning>
What’s new since the last beta?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• opam now uses CLI versioning ([#4385])
• opam now exits with code 31 if all failures were during fetch
operations ([#4214])
• `opam install' now has a `--download-only' flag ([#4036]), allowing
opam’s caches to be primed
• `opam init' now advises the correct shell-specific command for `eval
$(opam env)' ([#4427])
• `post-install' hooks are now allowed to modify or remove installed
files ([#4388])
• New package variable `opamfile-loc' with the location of the
installed package opam file ([#4402])
• `opam update' now has `--depexts' flag ([#4355]), allowing the
system package manager to update too
• depext support NetBSD and DragonFlyBSD added ([#4396])
• The format-preserving opam file printer has been overhauled
([#3993], [#4298] and [#4302])
• pins are now fetched in parallel ([#4315])
• `os-family=ubuntu' is now treated as `os-family=debian' ([#4441])
• `opam lint' now checks that strings in filtered package formulae are
booleans or variables ([#4439])
and many other bug fixes as listed [on the release page].
[#4385] <https://github.com/ocaml/opam/pull/4385>
[#4214] <https://github.com/ocaml/opam/issues/4214>
[#4036] <https://github.com/ocaml/opam/issues/4036>
[#4427] <https://github.com/ocaml/opam/pull/4427>
[#4388] <https://github.com/ocaml/opam/pull/4388>
[#4402] <https://github.com/ocaml/opam/pull/4402>
[#4355] <https://github.com/ocaml/opam/issues/4355>
[#4396] <https://github.com/ocaml/opam/pull/4396>
[#3993] <https://github.com/ocaml/opam/issues/3993>
[#4298] <https://github.com/ocaml/opam/pull/4298>
[#4302] <https://github.com/ocaml/opam/pull/4302>
[#4315] <https://github.com/ocaml/opam/issues/4315>
[#4441] <https://github.com/ocaml/opam/pull/4441>
[#4439] <https://github.com/ocaml/opam/issues/4439>
[on the release page]
<https://github.com/ocaml/opam/releases/tag/2.1.0-beta4>
New Plugins
╌╌╌╌╌╌╌╌╌╌╌
Several features that were formerly plugins have been integrated into
opam 2.1.0. We have also developed some _new_ plugins that satisfy
emerging workflows from the community and the core OCaml team. They
are available for use with the opam 2.1 beta as well, and feedback on
them should be directed to the respective GitHub trackers for those
plugins.
opam compiler
┄┄┄┄┄┄┄┄┄┄┄┄┄
The [`opam compiler'] plugin can be used to create switches from
various sources such as the main opam repository, the ocaml-multicore
fork, or a local development directory. It can use Git tag names,
branch names, or PR numbers to specify what to install.
Once installed, these are normal opam switches, and one can install
packages in them. To iterate on a compiler feature and try opam
packages at the same time, it supports two ways to reinstall the
compiler: either a safe and slow technique that will reinstall all
packages, or a quick way that will just overwrite the compiler in
place.
[`opam compiler'] <https://github.com/ocaml-opam/opam-compiler>
opam monorepo
┄┄┄┄┄┄┄┄┄┄┄┄┄
The [`opam monorepo'] plugin lets you assemble standalone dune
workspaces with your projects and all of their opam dependencies,
letting you build it all from scratch using only Dune and OCaml. This
satisfies the “monorepo” workflow which is commonly requested by large
projects that need all of their dependencies in one place. It is also
being used by projects that need global cross-compilation for all
aspects of a codebase (including C stubs in packages), such as the
MirageOS unikernel framework.
[`opam monorepo'] <https://github.com/ocamllabs/opam-monorepo>
Next Steps
╌╌╌╌╌╌╌╌╌╌
This is anticipated to be the final beta in the 2.1 series, and we
will be moving to release candidate status after this. We could really
use your help with testing this release in your infrastructure and
projects and let us know if you run into any blockers. If you have
feature requests, please also report them on [our issue tracker] – we
will be planning the next release cycle once we ship opam 2.1.0
shortly.
[our issue tracker] <https://github.com/ocaml/opam/issues>
Set up OCaml 1.1.6
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-6/7276/1>
Sora Morimoto announced
───────────────────────
This release includes a change to make the OCaml CI workflow on
Windows faster!
I tested this on one of my repos where the build itself is
mere seconds. Before this change, setup-ocaml needed an
average of 5:39 to install OCaml+opam and 1:53 to build
the dependencies of the library. After this change, it
needs an average of 3:15 for the installation and 1:27 for
the deps.
Changed
╌╌╌╌╌╌╌
• Windows installs Cygwin to `D:\cygwin', using faster Azure temporary
storage.
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.6>
Set up OCaml 1.1.7
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-7/7279/1>
Sora Morimoto announced
───────────────────────
Changed
╌╌╌╌╌╌╌
• Ubuntu and macOS runners no longer display "No switch is currently
installed." before building the compiler.
• Ubuntu no longer installs the system ocaml packages.
• macOS no longer builds two compilers on every run.
• Upgrade opam to 2.0.8 for Linux VMs.
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.7>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 32262 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-02-02 13:56 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-02-02 13:56 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 18840 bytes --]
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:
<https://discuss.ocaml.org/t/ann-release-0-2-2-of-ppx-deriving-encoding/7169/1>
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]
<https://discuss.ocaml.org/t/ann-json-data-encoding-0-9/7157>
[gitlab] <https://gitlab.com/o-labs/ppx_deriving_encoding>
OCaml 4.12.0, second beta release
═════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-4-12-0-second-beta-release/7171/1>
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:
<https://github.com/ocaml/ocaml/issues>
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 <switch_name> --packages=ocaml-variants.4.12.0~beta2+options,<option_list>
│ --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where <option_list> 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:
• <https://github.com/ocaml/ocaml/archive/4.12.0-beta2.tar.gz>
• <https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.0~beta2.tar.gz>
If you want to test this version, you may want to install the alpha
opam repository
<https://github.com/kit-ty-kate/opam-alpha-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] <https://github.com/ocaml/ocaml/issues/9757>
[9846] <https://github.com/ocaml/ocaml/issues/9846>
[10161] <https://github.com/ocaml/ocaml/issues/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] <https://github.com/ocaml/ocaml/issues/10063>
[2024] <https://github.com/ocaml/ocaml/issues/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] <https://github.com/ocaml/ocaml/issues/9755>
[10142] <https://github.com/ocaml/ocaml/issues/10142>
[10154] <https://github.com/ocaml/ocaml/issues/10154>
OCaml Office Hours?
═══════════════════
Archive: <https://discuss.ocaml.org/t/ocaml-office-hours/7132/9>
Deep in this thread, Orbifx said
────────────────────────────────
And there is XMPP: <xmpp:ocaml@conference.orbitalfox.eu?join>
Timere 0.1.3 - Dealing with time and time zones have never been easier
══════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-timere-0-1-3-dealing-with-time-and-time-zones-have-never-been-easier/7173/1>
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] <https://github.com/daypack-dev/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] <https://github.com/daypack-dev/timere/tree/main/examples>
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: <https://github.com/daypack-dev/timere>
• API doc:
<https://daypack-dev.github.io/timere/timere/Timere/index.html>
Interesting OCaml Articles
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/interesting-ocaml-articles/1867/92>
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:
<https://www.ft.com/content/81811f27-4a8f-4941-99b3-2762cae76542>
json-data-encoding 0.9
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-json-data-encoding-0-9/7157/2>
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:
<https://discuss.ocaml.org/t/ann-ocamlearlybird-1-0-0-beta1/7180/1>
文宇祥 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] <https://github.com/hackwaly/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]
<https://media.githubusercontent.com/media/hackwaly/ocamlearlybird/master/_assets/utop.webp>
Cmdliner cheatsheet
═══════════════════
Archive: <https://discuss.ocaml.org/t/cmdliner-cheatsheet/7185/1>
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]
<https://discuss.ocaml.org/t/what-are-some-libraries-you-almost-always-use/7165/17?u=mjambon>
[cheatsheet and a template]
<https://github.com/mjambon/cmdliner-cheatsheet>
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]
<https://github.com/mjambon/cmdliner-cheatsheet/tree/main/src>
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:
<https://github.com/shonfeder/kwdcmd>
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: <https://discuss.ocaml.org/t/ann-containers-3-2/7196/1>
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]
<https://github.com/c-cube/ocaml-containers/releases/tag/v3.2>
OCaml Café: Thu, Feb 11 @ 7pm (U.S. Central)
════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-cafe-thu-feb-11-7pm-u-s-central/7197/1>
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] <https://hfpug.org>
Dependency graph of some OCaml source files
═══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/dependency-graph-of-some-ocaml-source-files/7198/6>
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] <https://gitlab.com/camlspotter/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] <http://ocaml.org/community/planet/>
[Recent and upcoming changes to Merlin]
<https://tarides.com/blog/2021-01-26-recent-and-upcoming-changes-to-merlin>
[The road ahead for MirageOS in 2021] <https://hannes.nqsb.io/Posts/NGI>
[Release of Alt-Ergo 2.4.0]
<https://www.ocamlpro.com/2021/01/22/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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <https://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 37092 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-01-26 13:25 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-01-26 13:25 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 31437 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of January 19 to 26,
2021.
Table of Contents
─────────────────
How to get pleasant documentation for a library using Dune?
Alt-Ergo 2.4.0 release
First release of Art - Adaptive Radix Tree in OCaml
perf demangling of OCaml symbols (and a short introduction to perf)
Decimal 0.2.1 - arbitrary-precision decimal floating point
Basic GitLab CI configuration
OCaml Office Hours?
json-data-encoding 0.9
VSCode OCaml Platform v1.6.0
release 0.3.0 of drom, the OCaml project creator
Old CWN
How to get pleasant documentation for a library using Dune?
═══════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/how-to-get-pleasant-documentation-for-a-library-using-dune/7121/1>
gasche announced
────────────────
I'm working to publish a small library using Dune. The documentation
automatically generated by `dune build @doc' looks fairly unpleasant
to me, as I don't see an easy way to explain what the library is
about. I'm creating this topic in case I am missing something simple,
and to get other people to share their library-documentation practices
or examples.
Problem description
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
For the sake of the example let's imagine that the library is called
`Foo' and contains three modules `A', `B' and `C'. I'm using the
standard dune approach of wrapped modules, so I get three compilation
units `Foo.A', `Foo.B', `Foo.C'. Each module has a `.mli' file with
documentation comments.
When I run `dune build @doc', dune generates an `index.html' file with
basically no content, pointing to a `foo/index.html' file with
basically no content, pointing to a `foo/Foo/index.html' looking like
this:
Up – foo » Foo
*Module `Foo'*
`module A : sig ... end'
`module B : sig ... end'
`module C : sig ... end'
It's easy to skip the first two pages, and use the third page as a
landing page for the documentation of my library. However, this
landing page is not very pleasant:
1. It should explain what the library is about.
2. It should briefly describe what each module does, so that users
know which module they want to look at first.
(Point 2 is especially important with "wrapped libraries", where it's
not necessarily obvious which of the several modules is the main entry
point with the important functions to look at first. In comparison, in
a design where the "entry point" is in the `Foo' module, with `Foo.A'
and `Foo.B' as more advanced submodules (or `Foo_A' and `Foo_B' in the
old days) the user is guided to look at `Foo' first.)
My problem is: what should I change in my Dune setup to be able to do
this?
I have read the [dune documentation on documentation], but I could not
find an answer to this question.
[dune documentation on documentation]
<https://dune.readthedocs.io/en/stable/documentation.html>
Rough ideas
╌╌╌╌╌╌╌╌╌╌╌
Roughly I see two ways to get what I want, that I have not tried yet:
1. I could write my own landing page for the library as a separate
`doc.mld' file, use the `(documentation)' stanza to get it included
in the built documentation, and use this as the entry point into my
library.
2. In could write my own `foo.ml' module instead of using Dune's
default wrapped-module scaffolding, inserting my own `module A =
Foo__A' aliases, with documentation comments in the standard
style. Then I suppose that `foo/Foo/index.html' would get this
content in the way I expect.
They feel a bit complex to me, and (2) involves the tedious work of
redoing the wrapping logic myself. I guess that (1) is not so bad, and
I would be inclined to do this if it was documented somewhere as the
recommended approach.
(Maybe there is some odoc option that would help solve this problem?)
Examples from other people?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Do you have a library built using dune with nice documentation? If so,
can you show the documentation and the corresponding sources (in
particular dune setup)?
Thibaut Mattio replied
──────────────────────
I think the documentation of [Streaming] is a great example of the
option 1 you describe.
The corresponding Dune setup can be found [here]
That's also the approach we took for [Opium's documentation], although
the index page is certainly not as impressive as Streaming's.
[Streaming] <https://odis-labs.github.io/streaming/streaming/index.html>
[here]
<https://github.com/odis-labs/streaming/blob/master/streaming/dune>
[Opium's documentation]
<https://rgrinberg.github.io/opium/opium/index.html>
gasche then said
────────────────
Thanks! It looks like these systems rely on an undocumented feature of
the `(documentation)' stanza (or odoc), which is that a user-provided
`index.mld' file will implicitly replace the automatically-generated
`index.mld' file, giving a reasonably natural result.
The opium documentation also [uses] the `{!modules: modulename ...}'
markup directive, which is a way to include the module index within
this manually-written landing page without having to duplicate the
markup. Streaming¹ uses [inline html] instead to get a nicer-looking
result, but it is too much effort. Maybe there is a better way, or the
tools could be improved to make this easier.
¹: I'm ashamed to admit that I wasn't aware of this very nice library
[Streaming], am I consuming the wrong sources of information on the
OCaml ecosystem?
Finally, the Opium documentation manifestly has a short synopsis for
each module in its listing, which corresponds to my "It should briefly
describe what each module does" requirement. I believe that this comes
from the first line of the first documentation comment of the
module. There are module-global documentation comments in the library
I'm working on, but they do not include such first-line headers.
Once I have the impression of understanding what is a good way to do
this, I may try to contribute better documentation in `dune'.
[uses]
<https://github.com/rgrinberg/opium/blob/2a89e35/opium/doc/index.mld#L72-L74>
[inline html]
<https://github.com/odis-labs/streaming/blob/ee5d82a/streaming/index.mld#L32-L68>
[Streaming] <https://odis-labs.github.io/streaming/streaming/index.html>
Gabriel Radanne replied
───────────────────────
It looks like these systems rely on an undocumented
feature of the `(documentation)' stanza (or odoc), which
is that a user-provided `index.mld' file will implicitly
replace the automatically-generated `index.mld' file,
giving a reasonably natural result.
I confirm this feature is here to stay, is the right one to customize
your index page, and in the future will benefit from good support from
odoc directly.
The opium documentation also [uses] the `{!modules:
modulename ...}' markup directive, which is a way to
include the module index within this manually-written
landing page without having to duplicate the
markup. Streaming¹ uses [inline html] instead to get a
nicer-looking result, but it is too much effort. Maybe
there is a better way, or the tools could be improved to
make this easier.
I would strongly advise to use the `modules' markup directive, and to
suggests output improvements on odoc's bug instead of hacking HTML
together. We could absolutely add the synopsis of the module here, for
instance.
[uses]
<https://github.com/rgrinberg/opium/blob/2a89e35/opium/doc/index.mld#L72-L74>
[inline html]
<https://github.com/odis-labs/streaming/blob/ee5d82a/streaming/index.mld#L32-L68>
Daniel Bünzli then said
───────────────────────
which is that a user-provided `index.mld' file will
implicitly replace the automatically-generated `index.mld'
file, giving a reasonably natural result.
This is also the correct way to customize the landing page of your
package for `odig' generated doc sets, see [here] for more
information.
I confirm this feature is here to stay, is the right one
to customize your index page, and in the future will
benefit from good support from odoc directly.
There's an open issue about that [here].
[here]
<https://erratique.ch/software/odig/doc/packaging.html#odoc_api_and_manual>
[here] <https://github.com/ocaml/odoc/issues/297>
Alt-Ergo 2.4.0 release
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-alt-ergo-2-4-0-release/7134/1>
OCamlPro announced
──────────────────
We are pleased to announce a new release of Alt-Ergo!
Alt-Ergo 2.4.0 is now available from [Alt-Ergo’s website]. An
associated opam package will be published in the next few days.
This release contains some major novelties:
• Alt-Ergo supports incremental commands (push/pop) from the[ smt-lib]
standard.
• We switched command line parsing to use[ cmdliner]. You will need to
use –<option name> instead of -<option name>. Some options have also
been renamed, see the manpage or the documentation.
• We improved the online documentation of your solver, available[
here].
This release also contains some minor novelties:
• .mlw and .why extension are depreciated, the use of .ae extension is
advised.
• Add –input (resp –output) option to manually set the input (resp
output) file format
• Add –pretty-output option to add better debug formatting and to add
colors
• Add exponentiation operation, ** in native Alt-Ergo syntax. The
operator is fully interpreted when applied to constants
• Fix –steps-count and improve the way steps are counted (AdaCore
contribution)
• Add –instantiation-heuristic option that can enable lighter or
heavier instantiation
• Reduce the instantiation context (considered foralls / exists) in
CDCL-Tableaux to better mimic the Tableaux-like SAT solver
• Multiple bugfixes
The full list of changes is available [here]. As usual, do not
hesitate to report bugs, to ask questions, or to give your feedback!
[Alt-Ergo’s website] <https://alt-ergo.ocamlpro.com/>
[ smt-lib] <https://smtlib.cs.uiowa.edu/>
[ cmdliner] <https://erratique.ch/software/cmdliner>
[ here] <https://ocamlpro.github.io/alt-ergo/>
[here] <https://ocamlpro.github.io/alt-ergo/About/changes.html>
First release of Art - Adaptive Radix Tree in OCaml
═══════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-art-adaptive-radix-tree-in-ocaml/7142/1>
Calascibetta Romain announced
─────────────────────────────
I'm glad to announce the first release of [`art'], an implementation
of [the Adaptive Radix Tree] in OCaml. The goal of this library is to
provide a data-structure such as `Map.S' (and keep the order) with
performances of `Hashtbl.t'.
[`art'] <https://github.com/dinosaure/art>
[the Adaptive Radix Tree] <https://db.in.tum.de/~leis/papers/ART.pdf>
Performances
╌╌╌╌╌╌╌╌╌╌╌╌
`art' uses [Bechamel] as a tool for micro-benchmarking and it compares
performances about [insertion] and [lookup]. As you can see, about
insertion, `art' is definitely more fast than `Hashtbl.t'.
For the _lookup_ operation, we are slightly more fast than the
`Hashtbl.t'. The main advantage comparing to `Hashtbl.t' is the
ability to use `maximum~/~minimum' or to `iter' over the whole
data-structure with a certain order.
On details, benchmarks use a normal distribution of `strings' about
their lengths. As a practical example where `art' will be better than
`Hashtbl.t' is when you want to _index_ several words (such as email
addresses).
[Bechamel] <https://github.com/mirage/bechamel>
[insertion] <https://dinosaure.github.io/art/bench/insert.html>
[lookup] <https://dinosaure.github.io/art/bench/find.html>
Tests
╌╌╌╌╌
Of course, the library provide [a fuzzer] and tests have a coverage
of: 91.93 %
[a fuzzer] <https://github.com/dinosaure/art/blob/master/fuzz/fuzz.ml>
Read Optimized Write Exclusion - ROWEX
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Even if it's not a part of the package, the distribution comes with
_lock-free_ implementation of `art': `rowex'. This implementation
comes from [a research paper] about data-structure and atomic
operations.
ROWEX provides a _persistent_ implementation which manipulates a file
to store the whole data-structure. The goal is to provide an _indexer_
free to be manipulated by several processes in parallel.
Currently, the implementation of ROWEX in OCaml is not well-tested and
it is no distributed. It does not take the advantage of
[ocaml-multicore] (but it should) but outcomes are good and the
development will be more focus on this part.
So feel free to play with it a bit :+1:.
[a research paper] <https://db.in.tum.de/~leis/papers/artsync.pdf>
[ocaml-multicore] <https://github.com/ocaml-multicore/ocaml-multicore>
perf demangling of OCaml symbols (and a short introduction to perf)
═══════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-perf-demangling-of-ocaml-symbols-a-short-introduction-to-perf/7143/1>
Fabian announced
────────────────
As a project sponsored by the [OCaml software foundation], I've worked
on demangling OCaml symbols in [perf]. Some screenshots are below. The
work is currently being upstreamed. In the meantime, it can be used as
follows:
┌────
│ git clone --depth=1 https://github.com/copy/linux.git
│ # or:
│ # wget https://github.com/copy/linux/archive/master.tar.gz && tar xfv master.tar.gz
│ cd linux/tools/perf
│ make
│ alias perf=$PWD/perf
│ # or copy perf to somewhere in your PATH
└────
Your distribution's version of perf will also work for the examples
below, but will have less readable symbols :-)
[OCaml software foundation] <https://ocaml-sf.org/>
[perf] <https://perf.wiki.kernel.org/index.php/Main_Page>
Short intruction to perf
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Perf is a Linux-only sampling profiler (and more), which can be used
to analyse the performance profile of OCaml and other
executables. When compiling with ocamlopt, add `-g' to include debug
information in the executable. dune does this automatically, even in
the release profile. To start a program and record its profile:
┌────
│ perf record --call-graph dwarf program.exe
└────
Or record a running program:
┌────
│ perf record --call-graph dwarf -p `pidof program.exe`
└────
Then, view a profile using:
┌────
│ perf report # top-down
│ perf report --no-children # bottom-up
└────
Within the report view, the following keybindings are useful:
• `+': open/close one callchain level
• `e': open/close entire callchain
• `t': Toggle beween current thread and all threads (e.g., only
`dune', `ocamlopt', etc.)
Or generate a flamegraph:
┌────
│ git clone https://github.com/brendangregg/FlameGraph
│ cd FlameGraph
│ perf script -i path/to/perf.data | ./stackcollapse-perf.pl | ./flamegraph.pl > perf-flamegraph.svg
└────
You may need to run the following command to allow recording by
non-root users ([more infos]):
┌────
│ echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid
└────
[more infos]
<https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html#unprivileged-users>
Sources
╌╌╌╌╌╌╌
• [Profiling OCaml code]
• <https://perf.wiki.kernel.org/index.php/Tutorial#Sampling_with_perf_record>
• <http://www.brendangregg.com/perf.html#FlameGraphs>
Before:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/9/95433869e4d55c6c822a096a901483304d44338d_2_1380x602.png>
After:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/3/3bf847ea23608973644175927e09d4d039ab720e_2_1380x602.png>
Bottom-up:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/0/01042663ccf66e8b955723fae3cd1c6ff9e0b029_2_1380x602.png>
Flamegraph (cropped):
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/c/c8e3e0f5b9e1d879198892395529ebb3c339c791_2_1380x602.png>
[Profiling OCaml code]
<https://github.com/ocaml-bench/notes/blob/master/profiling_notes.md>
Decimal 0.2.1 - arbitrary-precision decimal floating point
══════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/decimal-0-2-1-arbitrary-precision-decimal-floating-point/7144/1>
Yawar Amin announced
────────────────────
Happy to announce that `decimal' 0.2.1 has been [pubished on opam].
`decimal' is a port of [Python's `decimal' module] to OCaml and
implements the [General Decimal Arithmetic Specification]. However
note that it is a port in progress–basic arithmetic and rounding
functions have been ported, but I am still working on powers and
logs. The ported functions pass the same unit test suite that the
Python version does (with some minor modifications).
Another caveat: currently the library is only supported on 64-bit
architectures due to (exponent) overflow issues on 32-bit. If anyone
is willing to test and fix overflows on 32-bit, I am more than happy
to accept PRs.
Here's an example of using the module:
┌────
│ (* Rosetta Code Currency Example *)
│
│ (* Demo purposes, normally you'd prefix module name or local open *)
│ open Decimal
│
│ let hamburger_qty = of_string "4_000_000_000_000_000"
│ let hamburger_amt = of_string "5.50"
│ let milkshake_qty = of_int 2
│ let milkshake_amt = of_string "2.86"
│
│ (* Shortcut to divide 7.65 by 100 *)
│ let tax_rate = of_string "7.65e-2"
│
│ let subtotal = hamburger_qty * hamburger_amt + milkshake_qty * milkshake_amt
│ let tax = round ~n:2 (subtotal * tax_rate)
│ let total = subtotal + tax
│
│ let () = Format.printf "Subtotal: %a
│ Tax: %a
│ Total: %a\n" pp subtotal pp tax pp total
└────
You can get the package with: `opam install decimal'. Minimum OCaml
version 4.08.
[pubished on opam] <http://opam.ocaml.org/packages/decimal/>
[Python's `decimal' module]
<https://docs.python.org/3/library/decimal.html>
[General Decimal Arithmetic Specification]
<http://speleotrove.com/decimal/decarith.html>
Basic GitLab CI configuration
═════════════════════════════
Archive:
<https://discuss.ocaml.org/t/basic-gitlab-ci-configuration/3327/25>
gasche announced
────────────────
After a long ci-golfing adventure (83 tests), I got a `.gitlab-ci.yml'
file that I think is reusable and useful for small projects /
libraries:
• project: <https://gitlab.com/gasche/gitlab-ocaml-ci-example>
• configuration file:
<https://gitlab.com/gasche/gitlab-ocaml-ci-example/-/blob/main/.gitlab-ci.yml>
Features:
• It is project-agnostic, so it should work unchanged for your own
(simple) projects.
• It caches the opam dependencies.
• It builds the project, runs the tests and builds the documentation.
• Several compiler versions can be tested in parallel.
• It provides an easy way to upload the documentation as "Gitlab
project Pages".
CI times are satisfying: on very small libraries I observe a 11mn job
time on the first run (or when cleaning the opam cache), and 2mn job
time on following runs.
The expected usage-mode of this CI configuration is that you copy it
in your own project. If you find that you need/want additional
features, ideally you would try to write them in a project-agonistic
way and contribute them back to the example repository.
This configuration does not use @smondet's trick of generating a
docker image on the fly. I think this would be an excellent idea to
get more reliable caching, but it is too complex for me and I don't
see how to do it in a maintainable and project-agnostic way.
Current status
╌╌╌╌╌╌╌╌╌╌╌╌╌╌
I wrote this CI configuration over the week-end, and have not used it
much. I expect it to keep evolving somewhat before it
stabilizes. Feedback from other people trying to use the configuration
would be warmly welcome.
Aside on `_build' caching
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
I also implemented caching of dune's `_build' data, inspired by the
[data-encoding] example of @raphael-proust. I don't need it for my
small projects (dune build is 3s, compared to 1m setting up the Docker
image), but I thought it would make the CI configuration scale better
to larger projects.
When I tested this CI configuration, I discovered that caching the
dune `_build' data does not work as well as I had expected. (Tracking
issue: [dune#4150]).
I can tell because I am asking dune to tell me about what it is
rebuilding (`dune build --display short'). I suspect that projects
that cache the `_build' data *without* logging what dune (re)builds
are also not caching as much as they think they are.
(But then maybe the use of a fixed-compiler OPAM image, as
data-encoding is using, solves the issue.)
[data-encoding]
<https://gitlab.com/nomadic-labs/data-encoding/-/blob/master/.gitlab-ci.yml>
[dune#4150] <https://github.com/ocaml/dune/issues/4150>
official CI template?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
I considered submitting this CI configuration as an "OCaml Gitlab CI
template" to go with the official list of "blessed" CI templates in
[the documentation]. But reading the [Development guide for Gitlab
CI/CD templates] convinced me that my CI configuration is nowhere
ready to serve this role.
Gitlab developers apparently expect that users will be able to
"include" those CI templates by pointing to their URL, and then tune
it for their own use-case (without modifying it) by performing some
(unreasonable?) inheritance tricks using whatever those configurations
offers as abstraction/inheritance/extension/overriding
mechanism. Let's just say that this is next-level CI configuration
writing, and that my script is not ready for this.
[the documentation]
<https://docs.gitlab.com/ee/ci/examples/README.html#cicd-templates>
[Development guide for Gitlab CI/CD templates]
<https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/cicd/templates.md>
OCaml Office Hours?
═══════════════════
Archive: <https://discuss.ocaml.org/t/ocaml-office-hours/7132/4>
Deep in this thread, UnixJunkie said
────────────────────────────────────
In addition to mailing lists and discuss, there is also an IRC channel
where people can interact with some ocaml experts in a more
"interactive" manner (<irc://irc.freenode.net/#ocaml>)
json-data-encoding 0.9
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-json-data-encoding-0-9/7157/1>
Raphaël Proust announced
────────────────────────
On behalf of [Nomadic Labs], I'm happy to announce the release of
json-data-encoding version 0.9.
The code is hosted on Gitlab:
<https://gitlab.com/nomadic-labs/json-data-encoding> It is distributed
under GNU LGPL with linking exception. The documentation is available
online: <https://nomadic-labs.gitlab.io/json-data-encoding/> The
package is available under opam: `opam install json-data-encoding'
json-data-encoding is a library to define encoder/decoder values to
translate OCaml values to JSON and back. It also generates JSON
schemas so you can document the value representation. It can use
either Ezjsonm or Yojson as backends.
The version 0.9 has the following new features:
• more tests
• memoisation of fixpoint encoding to avoid repeated computations
• support for `format' field for string schemas (see
<https://json-schema.org/understanding-json-schema/reference/string.html#format>)
(contributed by @levillain.maxime)
• fixed integer bound printing in schemas (bug report by @pw374)
• support for json-lexeme streaming (see details below)
• support for inclusion/exclusion of default-value fields during
serialisation (contributed by @levillain.maxime)
• improved union-of-object schemas (contributed by @levillain.maxime)
One major difference with the previous release is the inclusion of a
lexeme-streaming JSON constructor. Specifically, the function
┌────
│ val construct_seq : 't encoding -> 't -> jsonm_lexeme Stdlib.Seq.t
└────
generates a sequence of `Jsonm.lexeme' (the . This sequence is lazy
(in the sense of `Stdlib.Seq' not of `Stdlib.Lazy') and it paves the
way to a similar feature in `data-encoding'. An interesting feature of
sequences is that they can be used in Vanilla OCaml settings as well
as Lwt/Async settings where they allow user-driven yielding in between
elements.
[Nomadic Labs] <https://nomadic-labs.com/>
VSCode OCaml Platform v1.6.0
════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-vscode-ocaml-platform-v1-6-0/7164/1>
Rudi Grinberg announced
───────────────────────
On behalf of the vscode-ocaml-platform team, I'm pleased to announce
1.6.0. This release contains a new activity tab for managing opam
switches developed by @tmattio. We hope you find it useful.
Change log:
┌────
│ - Highlight token aliases in Menhir associativity declarations (#473)
│
│ - Activate the extension when workspace contains OCaml, Reason sources or
│ project marker files. (#482)
│
│ - Add `ocaml.useOcamlEnv` setting to determine whether to use `ocaml-env` for
│ opam commands from OCaml for Windows (#481)
│
│ - Fix terminal creation when using default shell and arguments (#484)
│
│ - Add an OCaml activity tab.
│
│ The activity tab provides three views: the available switches, the build
│ commands and an Help and Feedback section with links to community channels.
│
│ - Support `eliom` and `eliomi` file extensions (#487)
│
│ - Fix ocaml/ocaml-lsp#358: automatic insertion of an inferred interface was
│ inserting code incorrectly on the second switch to the newly created (unsaved)
│ `mli` file. If the new `mli` file isn't empty, we don't insert inferred
│ interface (#498)
└────
release 0.3.0 of drom, the OCaml project creator
════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-0-3-0-of-drom-the-ocaml-project-creator/7166/1>
Fabrice Le Fessant announced
────────────────────────────
We are pleased to release version 0.3.0 of `drom', the OCaml project
creator.
`drom' is born from a simple observation: every time you create a new
OCaml project, you spend time searching and copy-pasting files from
other projects, adapting them to the new one. `drom' does that for
you: it comes with a set of predefined skeleton projects, that you can
easily configure and adapt to your goal.
It's as easy as:
┌────
│ $ drom new
│ # check the list of skeletons
│ $ drom new PROJECT_NAME --skeleton SKELETON_NAME
│ $ cd PROJECT_NAME
│ $ emacs drom.toml
│ # ... edit basic description, dependencies, etc. ...
│ $ drom project
│ $ drom build
└────
Thanks to contributors (Maxime Levillain and David Declerck), the list
of project skeletons for drom 0.3.0 has grown:
• OCaml projects: library menhir mini_lib mini_prg ppx_deriver
ppx_rewriter program
• C Bindings: c_binding ctypes_foreign ctypes_stubs
• Javascript projects: js_lib js_prg vue wasm_binding
and you can easily contribute your own: for example,
`gh:USER/SKELETON' will trigger the download of the `USER/SKELETON'
project from Github as a template for your new project.
`drom' is available from `opam': `opam update && opam install
drom.0.3.0'
<https://github.com/ocamlpro/drom>
Enjoy !
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 49515 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-01-19 14:28 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-01-19 14:28 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 22382 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of January 12 to 19,
2021.
Table of Contents
─────────────────
Irmin 2.3.0
Dune 2.8.0
lwt-canceler.0.3
Interesting OCaml Articles
OCaml 4.12.0, first beta release
OCaml for ARM MacOS
Talk on OCaml Batteries at Houston Functional Programmers
Other OCaml News
Old CWN
Irmin 2.3.0
═══════════
Archive: <https://discuss.ocaml.org/t/ann-irmin-2-3-0/7084/1>
Craig Ferguson announced
────────────────────────
I'm very happy to announce the release of the Irmin 2.3.0 family of
packages, including:
• [`irmin-pack.2.3.0'], a storage backend for Irmin designed for and
used by Tezos. This release contains a host of performance
improvements as well as offline CLI features such as integrity
checking. It also contains a number of high-level design changes,
which were discussed in a recent [Tarides blog post].
Finally, `irmin-pack.2.3.0' also contains a prototype of the
[_layered_] `irmin-pack' store, which provides an [OverlayFS]-esque
mode of operation for `irmin-pack' in which the causal history of
the store can be chunked into independently-accessable
substores. This feature will eventually be deployed in a [future
version of Tezos].
• [`irmin-containers'], a collection of pre-defined mergeable data
structures built using Irmin and compatible with any backend. These
were originally provided by @kayceesrk as part of [`ezirmin'], and
has since been modernised and upstreamed by Anirudh S.
• `irmin-bench', a suite of benchmarks for Irmin for use with
[`current-bench'], an experimental continuous benchmarking
infrastructure for OCaml projects. Lots of work has been going on
behind the scenes to make this a general benchmarking infrastructure
for the Mirage ecosystem, including a recent [fancy UI overhaul] by
new contributor @rizo.
• [`repr'], an extraction of the `Irmin.Type' type representation
library for use in other packages. This package contains a set of
combinators for building run-time representations of types, along
with various generic operations defined over those representations,
including: equality, comparison, pretty-printing, JSON / binary
codecs, etc. The API of this library is currently a
work-in-progress, but we hope to use it more widely in the Mirage
ecosystem soon.
• [`semaphore-compat'], an extraction of the `Semaphore' library in
OCaml 4.12, for libraries that want to maintain compatibility with
earlier versions of OCaml.
The full list of changes to Irmin can be found [here].
Many thanks to our open-source contributors and collaborators. Happy
hacking!
[`irmin-pack.2.3.0'] <https://www.youtube.com/watch?v=v1lfMUM332w>
[Tarides blog post]
<https://tarides.com/blog/2020-09-08-irmin-september-2020-update>
[_layered_]
<https://gist.github.com/icristescu/1afb7f9f862f8e989b8b6c195908e7d0>
[OverlayFS] <https://en.wikipedia.org/wiki/OverlayFS>
[future version of Tezos]
<https://gitlab.com/tezos/tezos/-/merge_requests/2127>
[`irmin-containers']
<https://mirage.github.io/irmin/irmin-containers/Irmin_containers/index.html>
[`ezirmin'] <https://github.com/kayceesrk/ezirmin>
[`current-bench'] <https://github.com/ocurrent/current-bench/>
[fancy UI overhaul] <https://github.com/ocurrent/current-bench/pull/20>
[`repr'] <https://github.com/mirage/repr>
[`semaphore-compat'] <https://github.com/mirage/semaphore-compat>
[here]
<https://github.com/mirage/irmin/blob/master/CHANGES.md#230-2020-01-12>
Dune 2.8.0
══════════
Archive: <https://discuss.ocaml.org/t/ann-dune-2-8-0/7090/1>
Rudi Grinberg announced
───────────────────────
On behalf of the dune, I'm pleased to announce the release of dune
2.8.0. This release contains many bug fixes, performance improvements,
and interesting new features. I'll point out two new features that I'm
most excited about.
First is the experimental `dune_site' extension that makes it possible
to register and load plugins at runtime. This feature is quite
involved, but we've documented it extensively [in the manual].
Another cool feature is that we've eliminated the need for .merlin
files and all the caveats that came with them. Now, merlin talks to
dune directly to get precise configuration for every module. Say
goodbye to all those "approximate .merlin file" warnings!
I encourage everyone to upgrade as soon as possible, as earlier
versions are not compatible with OCaml 4.12. Happy Hacking.
Full change log:
[in the manual] <https://dune.readthedocs.io/en/stable/sites.html>
2.8.0 (13/01/2021)
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• `dune rules' accepts aliases and other non-path rules (#4063,
@mrmr1993)
• Action `(diff reference test_result)' now accept `reference' to be
absent and in that case consider that the reference is empty. Then
running `dune promote' will create the reference file. (#3795,
@bobot)
• Ignore special files (BLK, CHR, FIFO, SOCKET), (#3570, fixes #3124,
#3546, @ejgallego)
• Experimental: Simplify loading of additional files (data or code) at
runtime in programs by introducing specific installation sites. In
particular it allow to define plugins to be installed in these
sites. (#3104, #3794, fixes #1185, @bobot)
• Move all temporary files created by dune to run actions to a single
directory and make sure that actions executed by dune also use this
directory by setting `TMPDIR' (or `TEMP' on Windows). (#3691, fixes
#3422, @rgrinberg)
• Fix bootstrap script with custom configuration. (#3757, fixes #3774,
@marsam)
• Add the `executable' field to `inline_tests' to customize the
compilation flags of the test runner executable (#3747, fixes #3679,
@lubegasimon)
• Add `(enabled_if ...)' to `(copy_files ...)' (#3756, @nojb)
• Make sure Dune cleans up the status line before exiting (#3767,
fixes #3737, @alan-j-hu)
• Add `{gitlab,bitbucket}' as options for defining project sources
with `source' stanza `(source (<host> user/repo))' in the
`dune-project' file. (#3813, @rgrinberg)
• Fix generation of `META' and `dune-package' files when some targets
(byte, native, dynlink) are disabled. Previously, dune would
generate all archives for regardless of settings. (#3829, #4041,
@rgrinberg)
• Do not run ocamldep to for single module executables &
libraries. The dependency graph for such artifacts is trivial
(#3847, @rgrinberg)
• Fix cram tests inside vendored directories not being interpreted
correctly. (#3860, fixes #3843, @rgrinberg)
• Add `package' field to private libraries. This allows such libraries
to be installed and to be usable by other public libraries in the
same project (#3655, fixes #1017, @rgrinberg)
• Fix the `%{make}' variable on Windows by only checking for a `gmake'
binary on UNIX-like systems as a unrelated `gmake' binary might
exist on Windows. (#3853, @kit-ty-kate)
• Fix `$ dune install' modifying the build directory. This made the
build directory unusable when `$ sudo dune install' modified
permissions. (fix #3857, @rgrinberg)
• Fix handling of aliases given on the command line (using the `@' and
`@@' syntax) so as to correctly handle relative paths. (#3874, fixes
#3850, @nojb)
• Allow link time code generation to be used in preprocessing
executable. This makes it possible to use the build info module
inside the preprocessor. (#3848, fix #3848, @rgrinberg)
• Correctly call `git ls-tree' so unicode files are not quoted, this
fixes problems with `dune subst' in the presence of unicode
files. Fixes #3219 (#3879, @ejgallego)
• `dune subst' now accepts common command-line arguments such as
`--debug-backtraces' (#3878, @ejgallego)
• `dune describe' now also includes information about executables in
addition to that of libraries. (#3892, #3895, @nojb)
• instrumentation backends can now receive arguments via
`(instrumentation (backend <name> <args>))'. (#3906, #3932, @nojb)
• Tweak auto-formatting of `dune' files to improve
readability. (#3928, @nojb)
• Add a switch argument to opam when context is not default. (#3951,
@tmattio)
• Avoid pager when running `$ git diff' (#3912, @AltGr)
• Add `(root_module ..)' field to libraries & executables. This makes
it possible to use library dependencies shadowed by local modules
(#3825, @rgrinberg)
• Allow `(formatting ...)' field in `(env ...)' stanza to set
per-directory formatting specification. (#3942, @nojb)
• [coq] In `coq.theory', `:standard' for the `flags' field now uses
the flags set in `env' profile flags (#3931 , @ejgallego @rgrinberg)
• [coq] Add `-q' flag to `:standard' `coqc' flags , fixes #3924,
(#3931 , @ejgallego)
• Add support for Coq's native compute compilation mode (@ejgallego,
#3210)
• Add a `SUFFIX' directive in `.merlin' files for each dialect with no
preprocessing, to let merlin know of additional file extensions
(#3977, @vouillon)
• Stop promoting `.merlin' files. Write per-stanza Merlin
configurations in binary form. Add a new subcommand `dune
ocaml-merlin' that Merlin can use to query the configuration
files. The `allow_approximate_merlin' option is now useless and
deprecated. Dune now conflicts with `merlin < 3.4.0' and
`ocaml-lsp-server < 1.3.0' (#3554, @voodoos)
• Configurator: fix a bug introduced in 2.6.0 where the configurator
V1 API doesn't work at all when used outside of dune. (#4046,
@aalekseyev)
• Fix `libexec' and `libexec-private' variables. In cross-compilation
settings, they now point to the file in the host context. (#4058,
fixes #4057, @TheLortex)
• When running `$ dune subst', use project metadata as a fallback when
package metadata is missing. We also generate a warning when `(name
..)' is missing in `dune-project' files to avoid failures in
production builds.
• Remove support for passing `-nodynlink' for executables. It was
bypassed in most cases and not correct in other cases in particular
on arm32. (#4085, fixes #4069, fixes #2527, @emillon)
• Generate archive rules compatible with 4.12. Dune longer attempt to
generate an archive file if it's unnecessary (#3973, fixes #3766,
@rgrinberg)
• Fix generated Merlin configurations when multiple preprocessors are
defined for different modules in the same folder. (#4092, fixes
#2596, #1212 and #3409, @voodoos)
• Add the option `use_standard_c_and_cxx_flags' to `dune-project' that
1. disables the unconditional use of the `ocamlc_cflags' and
`ocamlc_cppflags' from `ocamlc -config' in C compiler calls, these
flags will be present in the `:standard' set instead; and 2. enables
the detection of the C compiler family and populates the `:standard'
set of flags with common default values when building CXX
stubs. (#3875, #3802, fix #3718 and #3528, @voodoos)
lwt-canceler.0.3
════════════════
Archive: <https://discuss.ocaml.org/t/ann-lwt-canceler-0-3/7092/1>
Raphaël Proust announced
────────────────────────
On behalf of [Nomadic Labs], I'm happy to announce the release of
Lwt-canceler version 0.3. Lwt-canceler is a small library to help
programs written using Lwt to synchronise promises around resource
clean-up. This library was developed as part of the [Tezos codebase]
before being released.
With this version, the code has matured significantly (including
tests, documentation and some refactoring); the next release will
probably be a version 1.0 at which point a more robust versioning
scheme will be used.
The documentation is available online:
<https://nomadic-labs.gitlab.io/lwt-canceler/lwt-canceler/Lwt_canceler/index.html>
The code is released under MIT License and hosted on Gitlab:
<https://gitlab.com/nomadic-labs/lwt-canceler> The new version is
available on opam: `opam install lwt-canceler'
Happy hacking!
[Nomadic Labs] <https://nomadic-labs.com/>
[Tezos codebase] <https://gitlab.com/tezos/tezos>
Interesting OCaml Articles
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/interesting-ocaml-articles/1867/90>
Weng Shiwei announced
─────────────────────
Let me share my new blog post on understanding `format6' with
examples. <https://blog.tail.moe/2021/01/13/format6.html>
It's almost my reading note for the paper Format Unraveled (on module
Format) and experiments on utop. I tried not to be too verbose though.
Weng Shiwei later said
──────────────────────
Well, I made a sequel of `format6' post, *Understanding `format6' in
OCaml by diagrams*
<https://blog.tail.moe/2021/01/15/format6-diagram.html>
This time I just use four examples with four diagrams e.g. it's the
one for `Scanf.sscanf'
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/f/f18093391072f739d70c68c2ccf4be92441078c2_2_1034x432.png>
p.s. It's a pity that I missed Gabriel's post [The 6 parameters of
(’a, ’b, ’c, ’d, ’e, ’f) format6] after writing that one.
[The 6 parameters of (’a, ’b, ’c, ’d, ’e, ’f) format6]
<http://gallium.inria.fr/blog/format6/>
OCaml 4.12.0, first beta release
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-4-12-0-first-beta-release/7099/1>
octachron announced
───────────────────
The release of OCaml 4.12.0 is close.
The set of new features has been stabilized, and core opam packages
already work with this release. After three alpha releases, we have
created a first beta version to help you adapt your software to the
new features ahead of the release. Compared to the last alpha, this
beta contains only three new bug fixes and one change to the standard
library.
The base compiler can be installed as an opam switch with the
following commands
┌────
│ opam update
│ opam switch create 4.12.0~beta1 --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 <switch_name> --packages=ocaml-variants.4.12.0~beta1+options,<option_list>
│ --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where <option_list> is a comma separated list of ocaml-option-*
packages. For instance, for a flambda and afl enabled switch:
┌────
│ opam switch create 4.12.0~beta1+flambda+afl
│ --packages=ocaml-variants.4.12.0~beta1+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:
• <https://github.com/ocaml/ocaml/archive/4.12.0-beta1.tar.gz>
• <https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.0~beta1.tar.gz>
If you want to test this version, you may want to install the alpha
opam repository
<https://github.com/kit-ty-kate/opam-alpha-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.
If you find any bugs, please report them here:
<https://github.com/ocaml/ocaml/issues>
Changes from the third alpha release
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Postponed features
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
• [9533], [10105], [10127] : Added String.starts_with and
String.ends_with. (Bernhard Schommer, review by Daniel Bünzli,
Gabriel Scherer and Alain Frisch)
[9533] <https://github.com/ocaml/ocaml/issues/9533>
[10105] <https://github.com/ocaml/ocaml/issues/10105>
[10127] <https://github.com/ocaml/ocaml/issues/10127>
Additional bug fixes
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
• [9096], [10096]: fix a 4.11.0 performance regression in
classes/objects declared within a function (Gabriel Scherer, review
by Leo White, report by Sacha Ayoun)
• [10106], [10112]: some expected-type explanations where forgotten
after some let-bindings (Gabriel Scherer, review by Thomas Refis and
Florian Angeletti, report by Daniil Baturin)
• [9326], [10125]: Gc.set incorrectly handles the three `custom_*'
fields, causing a performance regression (report by Emilio Jesús
Gallego Arias, analysis and fix by Stephen Dolan, code by Xavier
Leroy, review by Hugo Heuzard and Gabriel Scherer)
[9096] <https://github.com/ocaml/ocaml/issues/9096>
[10096] <https://github.com/ocaml/ocaml/issues/10096>
[10106] <https://github.com/ocaml/ocaml/issues/10106>
[10112] <https://github.com/ocaml/ocaml/issues/10112>
[9326] <https://github.com/ocaml/ocaml/issues/9326>
[10125] <https://github.com/ocaml/ocaml/issues/10125>
OCaml for ARM MacOS
═══════════════════
Archive: <https://discuss.ocaml.org/t/ocaml-for-arm-macos/6019/23>
Deep in this thread, Xavier Leroy said
──────────────────────────────────────
It's quite easy to get up to speed using the precompiled OPAM binary
for macOS/ARM64.
• Download [opam-2.0.7-arm64-macos].
• Move it to some directory in your PATH, rename it to `opam', and
make it executable. From a Terminal window:
┌────
│ mv ~/Downloads/opam-2.0.7-arm64-macos /usr/local/bin/opam
│ chmod +x /usr/local/bin/opam
└────
• Try to execute it: `opam init'. You will be blocked by the macOS
security checks, as the binary is not signed.
• Open Preferences / Security and Privacy. There should be a notice
"opam was blocked because…" and an "Allow Anyway" button. Click on
that button.
• Try again to execute `opam init'. You will be blocked again, but
now there is an "Open" button. Click on that button. `opam init'
should run and install the OCaml 4.10.2 compiler.
• From now on, you can run `opam' without being blocked. Use this
freedom to `opam install' the packages you need.
• Some packages that depend on external C libraries may fail to
install because these C libraries are not available. Normally we
would rely on Homebrew or MacPorts to provide these C libraries, but
these package collections are still being ported to macOS/ARM64.
As a reward for these minor inconveniences, you'll get excellent
performance running OCaml software such as Coq. Single-core
performance on a MacBook Air M1 is 20% better than the best x86
workstation I have access to.
[opam-2.0.7-arm64-macos]
<https://github.com/ocaml/opam/releases/download/2.0.7/opam-2.0.7-arm64-macos>
Talk on OCaml Batteries at Houston Functional Programmers
═════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/talk-on-ocaml-batteries-at-houston-functional-programmers/7103/1>
Claude Jager-Rubinson announced
───────────────────────────────
@UnixJunkie will be speaking (virtually, of course) on *OCaml
Batteries Included* at Houston Functional Programmers, this coming
Wednesday, Jan 20 at 7pm (U.S. Central time). His talk will cover
Batteries' history, place within the OCaml ecosystem, and comparisons
with OCaml's other alternative standard libraries. All are welcome to
join us, even if you're not from Houston. Complete details and Zoom
info are at [hfpug.org].
[hfpug.org] <https://hfpug.org>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Coq 8.13.0 is out]
[OCaml Planet] <http://ocaml.org/community/planet/>
[Coq 8.13.0 is out] <https://coq.inria.fr/news/coq-8-13-0-is-out.html>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 36261 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-01-12 9:47 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-01-12 9:47 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 19040 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of January 05 to 12,
2021.
Table of Contents
─────────────────
Marshal determinism and stability
Sedlex + Menhir parser for both tty and file parsing
First release of awa-ssh
Introducing Feather: A lightweight shell-scripting library for OCaml
postdoc researcher and research engineer positions for CHERI and Arm verification
First ocb (OCaml Badgen) release
Release of OCaml-Git v3.0 and co
Other OCaml News
Old CWN
Marshal determinism and stability
═════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/marshal-determinism-and-stability/7041/28>
Continuing this thread, David Allsopp said
──────────────────────────────────────────
A couple of notes on `Marshal', which I don't think have been covered
• Although the guarantee is only between identical versions of OCaml,
the implementation actually goes to considerable lengths to maintain
backwards compatibility (so a value _written_ by older OCaml remains
_readable_ in newer OCaml). Our own testsuite, for example,
indirectly [includes a test which unmarshals a 3.12.1 value]. I
don't know exactly how far back the support goes.
• As it happens, the change which affected Unison in 4.08 was the
first breaking change to Marshal since either 4.00 or 4.01. The fact
that it doesn't break often (and that the two code paths - at least
at present - are small) meant I have suggested a few months back
that we could in future add an additional flag in the style of
`Compat_32' to allow values to be written in a way which should be
readable on older versions of OCaml. Indeed, it's small enough that
flags could be added for the changes in 4.08 ([PR#1683]) and in 4.11
([PR#8791]).
• Neither point undermines using alternative formats either for
network serialisation or persistent storage, for the many reasons
discussed above!
[includes a test which unmarshals a 3.12.1 value]
<https://github.com/ocaml/ocaml/blob/trunk/testsuite/tests/lib-hashtbl/compatibility.ml>
[PR#1683] <https://github.com/ocaml/ocaml/pull/1683>
[PR#8791] <https://github.com/ocaml/ocaml/pull/8791>
Sedlex + Menhir parser for both tty and file parsing
════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/sedlex-menhir-parser-for-both-tty-and-file-parsing/7055/1>
Bernard Sufrin announced
────────────────────────
I am a great fan of Menhir, and have used it in several private
language projects, using the ulexing scanner generator to provide
Unicode-capable scanners.
Alarmed by the obsolescence of ulexing, and needing a utf8-capable
scanner in a hurry I decided to (teach myself to) use Sedlex. On the
whole the experience was very satisfactory, and I found it
straightforward to produce a variant of the sedlexing library which
supports buffers with variable chunk sizes, thereby enabling efficient
lexing on channels connected to files as well as immediately
responsive lexing on channels connected to terminals.
I also wanted to teach myself how to use the error-reporting,
incremental, interfaces to Menhir-generated parsers. In the hope that
it might be useful to others facing the same learning task, or the
problem of adapting Sedlex for efficient interactive use, I have
placed the example mock-S-Expression parser that resulted from this
excursion in:
[Git Repository: github.com/sufrin/InteractiveSedlexMenhirExample]
[Git Repository: github.com/sufrin/InteractiveSedlexMenhirExample]
<https://github.com/sufrin/InteractiveSedlexMenhirExample>
First release of awa-ssh
════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-awa-ssh/7057/1>
Hannes Mehnert announced
────────────────────────
I'm happy to announce that `awa-ssh'
(<https://github.com/mirage/awa-ssh>) has just been merged into
opam-repository. It is a pure OCaml implementation of the ssh (secure
shell, <https://en.wikipedia.org/wiki/SSH_(Secure_Shell)>) protocol.
This is the initial release, please report issues you encounter.
It was initially developed by Christiano Haesbaert in 2016, and
revived mid-2019 by myself and in 2020 it was migrated to the MirageOS
organization on GitHub for further development and maintenance.
Both client and server code are present in the library (pure code in
the main awa package), though the awa-lwt package implements only a
server, and the awa-mirage package implements only a client. Tests and
examples are in the test subdirectory.
The MirageOS client has been successfully used to clone git
repositories (on private servers, on GitHub, etc.). It supports apart
from RSA keys also ED25519 keys (and key exchanges).
Introducing Feather: A lightweight shell-scripting library for OCaml
════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/introducing-feather-a-lightweight-shell-scripting-library-for-ocaml/7059/1>
Charles announced
─────────────────
I wrote a shell scripting library called [Feather]. I like idea of
writing bash-like code quickly, later being able to intersperse OCaml
to add more typeful components as needed. It's kind of like [Shexp]
but without the monadic interface and with Async
support. ([Feather_async])
There's a tutorial and some examples in the link above but here's a
quick taste:
┌────
│ open Feather
│
│ let lines = find "." ~name:"*.ml"
│ |. tr "/" "\n"
│ |. map_lines ~f:String.capitalize
│ |. sort
│ |. process "uniq" [ "-c" ]
│ |. process "sort" [ "-n" ]
│ |. tail 4
│ |> collect_lines
│ in
│ String.concat ~sep:", " lines |> print_endline
└────
Let me know if you have any feedback! And feel free to file bug
reports [here]. Hope it ends up being useful, entertaining, or both!
[Feather] <https://hg.sr.ht/~etc/feather>
[Shexp] <https://github.com/janestreet/shexp/>
[Feather_async] <https://hg.sr.ht/~etc/feather_async>
[here] <https://todo.sr.ht/~etc/feather>
postdoc researcher and research engineer positions for CHERI and Arm verification
═════════════════════════════════════════════════════════════════════════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2021-01/msg00023.html>
Peter Sewell announced
──────────────────────
We are looking for postdoctoral researchers and postdoctoral or
postgraduate research engineers to help develop semantics and
verification to improve the foundations and security of mainstream
computer systems, for CHERI and Arm system software verification, at
the University of Cambridge. OCaml expertise to help develop
verification tools will be especially welcome. Closing date 13 January
2021 - see the advert <http://www.jobs.cam.ac.uk/job/28012/>.
First ocb (OCaml Badgen) release
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-ocb-ocaml-badgen-release/7073/1>
zapashcanon announced
─────────────────────
A few days ago, I released [ocb]. It's a library and a command-line
tool to generate SVG badges.
To get started quickly:
┌────
│ ocb --label Hello --color green --style flat --labelcolor white --status Goodbye
└────
Will gives this result: [SVG example].
My first use case was [To.ml] where I'm using [bisect_ppx] to generate
and deploy a [coverage report]. I wanted to display the coverage
percentage in the README and tried existing tools but wasn't fully
satisfied as they didn't work or were failing randomly. Now, [I'm
generating the badge directly in a GitHub action].
The project was inspired by [badgen]. I still have to add support for
icons and to improve the documentation but it's usable.
[ocb] <https://github.com/ocamlpro/ocb>
[SVG example]
<https://raw.githubusercontent.com/OCamlPro/ocb/master/example/cli.svg>
[To.ml] <https://github.com/ocaml-toml/To.ml>
[bisect_ppx] <https://github.com/aantron/bisect_ppx>
[coverage report] <https://ocaml-toml.github.io/To.ml/coverage/>
[I'm generating the badge directly in a GitHub action]
<https://github.com/ocaml-toml/To.ml/blob/6ac580848ad1d34ec3032da8672bbd9aca203cc4/.github/workflows/deploy.yml#L34>
[badgen] <https://github.com/badgen/badgen>
Release of OCaml-Git v3.0 and co
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-of-ocaml-git-v3-0-and-co/7076/1>
Ulugbek Abdullaev announced
───────────────────────────
We, the [`ocaml-git'] team, are happy to announce a new major release
of `ocaml-git v3.0' and related libraries.
[`ocaml-git'] <https://github.com/mirage/ocaml-git>
Release Notes
╌╌╌╌╌╌╌╌╌╌╌╌╌
OCaml-Git v3.0
┄┄┄┄┄┄┄┄┄┄┄┄┄┄
[*OCaml-Git*] is a library that implements `git' format and protocol
implementation in pure OCaml. The library is used by libraries such as
[`irmin'], a git-like distributed database, or [`pasteur'], a MirageOS
unikernel-based snippet storage service.
[*OCaml-Git*] <https://github.com/mirage/ocaml-git>
[`irmin'] <https://github.com/mirage/irmin>
[`pasteur'] <https://github.com/dinosaure/pasteur>
Changes
┈┈┈┈┈┈┈
The main goal behind this major release was to get better
compatibility with various platforms, including
[~MirageOS~](mirage.io), 32-bit platforms, and `js_of_ocaml'. In order
to achieve that, we broke down `ocaml-git' into several components,
which are represented as sub-libraries. We will describe some of those
components later in this post.
Along with better support for various platforms, `ocaml-git 3.0' also
comes with SSH support for `fetch/push' and various bug fixes.
The rest of the changes are mostly internal and pave a way for
interesting features such as a full-blown `git' [garbage collector]
and wire protocol v2 ([announcment] and [spec]).
*References:*
• Full [changes list]
• [PR] that introduced the major rewrite of `ocaml-git'
—
In the new version of `ocaml-git', we try to have better separation of
concerns by breaking some of the `ocaml-git' components into
sub-libraries, which do not contain `git'-specific logic and can be
reused for other purposes.
[garbage collector] <https://git-scm.com/docs/git-gc>
[announcment]
<https://opensource.googleblog.com/2018/05/introducing-git-protocol-version-2.html>
[spec]
<https://github.com/git/git/blob/master/Documentation/technical/protocol-v2.txt>
[changes list]
<https://github.com/mirage/ocaml-git/blob/master/CHANGES.md>
[PR] <https://github.com/mirage/ocaml-git/pull/395>
Carton
┄┄┄┄┄┄
Git uses [PACK files] to store old git objects such as commits and
transfer objects over wire using git's wire protocols (`git-nss'
library mentioned below implements [v1] of the protocol; [v2]
implementation is in progress).
[*Carton*] is a library to work with PACK files. The library does not
contain git-specific code, so one can easily reuse the library and
PACK format for non-git objects. One can see how `ocaml-git' uses
`carton' for its purposes [here].
*References:*
• [PR] that introduces `carton'
[PACK files]
<https://github.com/git/git/blob/master/Documentation/technical/pack-format.txt>
[v1]
<https://github.com/git/git/blob/master/Documentation/technical/pack-protocol.txt>
[v2]
<https://github.com/git/git/blob/master/Documentation/technical/protocol-v2.txt>
[*Carton*] <https://github.com/mirage/ocaml-git/tree/master/src/carton>
[here] <https://github.com/mirage/ocaml-git/tree/master/src/carton-git>
[PR] <https://github.com/mirage/ocaml-git/issues/375>
Git-NSS (Not So Smart)
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
When one wants to synchronize with a remote repository using git, they
need to use `git fetch/push'. Communication and
synchronization/negotiation is defined by git *wire protocol*, which
has two versions: older version 1 and newer leaner version 2. The
protocols are defined for four wire transports: HTTP(S), SSH, and
`git://' (TCP).
[`Not-So-Smart'] library is a library that allows for such
synchronization based on the git wire protocols but without
git-specific code, meaning that files being fetched do not need to be
git objects or that there is no assumptions on the "repository" that
one is synchronizing with. So, as well as `carton', the library aims
to be reusable for other purposes.
This release features support for SSH using [awa-ssh] by @hannesm (see
[the release]), support for [partial-clone] (of various `depth'), and
memory consumption fixes for unikernels.
*Note 1:* The library's name "Not so smart" is a play on the git's
"smart" protocol, a part of wire protocol v1 over HTTP(S) transport.
*Note 2:* only client side logic is implemented for wire
protocols. The server-side is planned but not yet implemented. One can
use `git' as the server for now.
[`Not-So-Smart']
<https://github.com/mirage/ocaml-git/tree/master/src/not-so-smart>
[awa-ssh] <https://github.com/mirage/awa-ssh>
[the release]
<https://discuss.ocaml.org/t/ann-first-release-of-awa-ssh/7057>
[partial-clone] <https://git-scm.com/docs/partial-clone>
Mimic
┄┄┄┄┄
[*Mimic*] is a small reimplementation of [`conduit'], a library that
helps to abstract over a transport protocol such as HTTP(S) or SSH. In
other words, the code using `mimic' can deal not with different types
that represent an HTTP or SSH connection, but just deal, e.g., read
from or write to, with a `flow' value, which hides protocol-specific
details under its hood.
—
There are several independent libraries that were upgraded along with
`ocaml-git 3.0'.
[*Mimic*] <https://github.com/mirage/ocaml-git/tree/master/src/mimic>
[`conduit'] <https://github.com/mirage/ocaml-conduit>
Duff v0.3
┄┄┄┄┄┄┄┄┄
[*Duff*] is a library that implements git's [`libXdiff'] (`xdiff'
algorithm) in OCaml. PACK files use a binary diff algorithm, `xdiff',
to compress binary data. More on the project [page] and release
[notes] for `ocaml-git 2.0'.
[*Duff*] <https://github.com/mirage/duff>
[`libXdiff'] <http://www.xmailserver.org/xdiff-lib.html>
[page] <https://github.com/mirage/duff>
[notes] <https://discuss.ocaml.org/t/ann-ocaml-git-2-0/2740>
Changes
┈┈┈┈┈┈┈
This release fixes the support for 32-bit architecture platforms.
Encore v0.7
┄┄┄┄┄┄┄┄┄┄┄
[*Encore*] is a library that can create an encoder/decoder based on
the format given. It also ensures isomorphism by construction.
[*Encore*] <https://github.com/mirage/encore>
Changes
┈┈┈┈┈┈┈
Extensive changes to the API. See the project page.
Decompress v1.2.0
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
[*Decompress*] is an OCaml implementation of certain decompression
algorithms such as `Zlib', `Gzip', etc.
[*Decompress*] <https://github.com/mirage/decompress>
Changes
┈┈┈┈┈┈┈
`ocaml-git 3.0' uses new version of `decompress' with extensive
performance improvements documented in *Tarides's* blog [API changes]
and [performance improvements].
We'd be happy to get your feedback or questions! :-)
[API changes]
<https://tarides.com/blog/2019-08-26-decompress-the-new-decompress-api>
[performance improvements]
<https://tarides.com/blog/2019-09-13-decompress-experiences-with-ocaml-optimization>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [How We Lost at The Delphi Oracle Challenge]
• [Tarides sponsors the Oxbridge Women in Computer Science Conference
2020]
• [Coq 8.12.2 is out]
• [First release of MetAcsl plugin]
• [Announcing MirageOS 3.10]
• [ ReScript 8.4]
• [Coq 8.13+beta1 is out]
[OCaml Planet] <http://ocaml.org/community/planet/>
[How We Lost at The Delphi Oracle Challenge]
<https://seb.mondet.org/b/0010-delphi-challenge-post-vivum.html>
[Tarides sponsors the Oxbridge Women in Computer Science Conference
2020]
<https://tarides.com/blog/2020-12-14-tarides-sponsors-the-oxbridge-women-in-computer-science-conference-2020>
[Coq 8.12.2 is out] <https://coq.inria.fr/news/coq-8-12-2-is-out.html>
[First release of MetAcsl plugin]
<https://frama-c.com/fc-plugins/metacsl.html>
[Announcing MirageOS 3.10]
<https://mirage.io/blog/announcing-mirage-310-release>
[ ReScript 8.4]
<https://rescript-lang.org/blog/bucklescript-release-8-4>
[Coq 8.13+beta1 is out]
<https://coq.inria.fr/news/coq-8-13beta1-is-out.html>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 32830 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2021-01-05 11:22 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2021-01-05 11:22 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 14635 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of December 29, 2020
to January 05, 2021.
Table of Contents
─────────────────
First release of Feat
OCluster and OBuilder
Plotting 3D vectors
Marshal determinism and stability
It there a tutorial for `js_of_ocaml' with simple graphics?
Interesting OCaml exercises from François Pottier available online
Old CWN
First release of Feat
═════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-feat/7033/1>
François Pottier announced
──────────────────────────
A brief note to announce the first release of Feat:
┌────
│ opam update
│ opam install feat
└────
Feat is a library that offers support for counting, enumerating, and
sampling objects of a certain kind, such as (say) the inhabitants of
an algebraic data type.
Feat was inspired by the paper "Feat: Functional Enumeration of
Algebraic Types" by Jonas Duregård, Patrik Jansson and Meng Wang
(2012).
More details can be found here:
<https://gitlab.inria.fr/fpottier/feat/>
OCluster and OBuilder
═════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocluster-and-obuilder/7035/1>
Thomas Leonard announced
────────────────────────
I'm pleased to announce the first release of [OCluster]. A user can
submit a build job (either a Dockerfile or an OBuilder spec) to the
scheduler, which then runs the build on a worker machine, streaming
the logs back to the client.
This is the build scheduler / cluster manager that we use for e.g.
[opam-repo-ci] (which you may have seen in action if you submitted a
package to opam-repository recently).
See [ocurrent/overview] for a quick overview of the various other CI
services using it too.
To install and run the scheduler use e.g.
┌────
│ opam depext -i ocluster
│ mkdir capnp-secrets
│ ocluster-scheduler \
│ --capnp-secret-key-file=./capnp-secrets/key.pem \
│ --capnp-listen-address=tcp:0.0.0.0:9000 \
│ --capnp-public-address=tcp:127.0.0.1:9000 \
│ --state-dir=/var/lib/ocluster-scheduler \
│ --pools=linux-arm32,linux-x86_64
└────
It will generate `key.pem' on the first run, as well as various
capability files granting access for workers and clients. You then
copy each generated pool capability (e.g. `pool-linux-x86_64.cap') to
each machine you want in that pool, and run `ocluster-worker
pool-linux-x86_64.cap' to start the worker agent. See the [README] for
full details.
[OBuilder] is an alternative to `docker build'. The main differences
are that it takes a spec in S-expression format, which is easier to
generate than a Dockerfile, handles concurrent builds reliably, and
keeps copies of the logs so that you still see the output even if
someone else performed the same build step earlier and the result is
therefore taken from the cache.
It currently supports ZFS and Btrfs for storage (it needs cheap
snapshots) and `runc' for sandboxing builds. [macos support] is under
development, but not yet upstreamed. It should be fairly easy to add
support for any platform that has some form of secure chroot.
OCluster supports monitoring with Prometheus, so you can see what the
cluster is doing:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/d/d5ff5aaa0259d7b59445b156e6b642a421040b64_2_920x750.png>
[OCluster] <https://github.com/ocurrent/ocluster>
[opam-repo-ci] <https://github.com/ocurrent/opam-repo-ci>
[ocurrent/overview] <https://github.com/ocurrent/overview>
[README] <https://github.com/ocurrent/ocluster/blob/master/README.md>
[OBuilder] <https://github.com/ocurrent/obuilder>
[macos support] <https://github.com/ocurrent/obuilder/issues/57>
Plotting 3D vectors
═══════════════════
Archive: <https://discuss.ocaml.org/t/plotting-3d-vectors/7038/1>
Andreas Poisel asked
────────────────────
I'm doing linear algebra with Owl. Owl-plplot works great for
visualizing 2D vectors, but it doesn't seem to capable of plotting 3D
vectors.
I took a (fast) look at vanilla [Plplot], [Oplot], and the [GNUplot
bindings], but I didn't find a simple way to plot 3D vectors.
I don't need high quality plots, 3D surfaces, a lot of control or
fancy features, just a coordinate system and some function to draw
geometric primitives (points, lines, circles, etc.).
Did I miss anything or do I have to build this myself with the good
old Graphics module?
[Plplot] <http://plplot.org/>
[Oplot] <https://github.com/sanette/oplot>
[GNUplot bindings] <https://github.com/c-cube/ocaml-gnuplot>
Marshall Abrams replied
───────────────────────
What kind of vector representation do you want? Just lines/arrows in
3D? That's just a curve in 3D, so it should be possible with Owl and
plplot, at least. Looks like it should be easy with oplot, too (but I
haven't used oplot). There are some 3D Owl plplot examples, with
source code, on these pages:
<https://ocaml.xyz/book/visualisation.html>
<https://github.com/owlbarn/owl/wiki/Tutorial:-How-to-Plot-in-Owl%3F>
<https://github.com/owlbarn/owl/wiki/Plot-Gallery>
I don't know whether it will be easy to adapt them to your needs. I
wrote the last example on the last page above. It's a plot of a
series 2D curves in 3D. Maybe some of the techniques can be adapted
to your needs. (The code is a few years old. I'm not sure whether it
works with the current version of Owl.)
(If you end up having to use low-level bindings to plplot, oplot,
etc. from Owl, you might consider contributing a wrapper module that
makes it easy to do the kind of plot you want.)
Andreas Poisel then said
────────────────────────
Thank you for your answer.
I'd just like to draw 3D vectors in a cartesian coordinate system. A
plot should look similar to this:
<https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/3D_Vector.svg/800px-3D_Vector.svg.png>
I wouldn't even need arrows, simple lines would be ok.
Maybe there is a way to use one of the 3D functions (`Plot.surf',
`Plot.mesh', `Plot.contour'), but I can't figure it out.
Hezekiah Carty replied
──────────────────────
It's been a while since I worked with plplot but what you showed
should be possible. The [plline3] function allows you to plot line
segments in 3d space. The function is setup to take multiple segments
in a single call. For a single segment each array would hold a single
value. Colors can be set between draw calls.
[plline3]
<http://plplot.org/docbook-manual/plplot-html-5.15.0/plline3.html>
sanette also replied
────────────────────
in oplot, there is the Curve3d object that should do it,
<https://sanette.github.io/oplot/oplot/Oplot/Plt/index.html#type-plot_object.Curve3d>
although it is quite rudimentary
Marshal determinism and stability
═════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/marshal-determinism-and-stability/7041/25>
Deep in this thread, Bikal Lem mentioned and Raphaël Proust described
─────────────────────────────────────────────────────────────────────
[Binary module of data-encoding]
Quick notes about this approach:
• It is used extensively in the Tezos codebase. For data exchange (in
the p2p layer), for data at rest (configuration files), and for a
mix of the two (serialisation of economic protocol data which is
both exchanged by peers and stored on disk).
• It is flexible in that you have great control over the
representation of data and the serialisation/deserialisation
procedure. There is a medium-term plan to allow even more
control. For now you can decide, say, if 8 booleans are represented
as one byte, 8 bytes, or 8 words (or something else altogether) (see
code below).
• Some of the responsibility for correctness rests upon your shoulders
as a user. E.g., when you encode a tuple, the left element must have
either a fixed length (e.g., be an int8, int32, etc., be a
fixed-length string, or be a tuple of fixed-length values) or be
prefixed by a length marker (which the library provides a combinator
for). Most of the errors for this are raised when you declare the
encoding and a few are raised when you use the encoding. I recommend
writing some tests to check that your encodings accept the range of
values that you are going to throw at them.
• The library is well tested: there are tests using crowbar to check
that encoding and decoding are actual inverse of each others.
Let me know if you have more questions. And in the meantime, here's
two different encodings for a tuple of 8 booleans:
┌────
│ (* easy-encoding, produces 8 bytes *)
│ let boolsas8bytes =
│ tup8 bool bool bool bool bool bool bool bool
│
│ (* very-compact encoding, produces 1 byte *)
│ let boolsas1byte =
│ conv
│ (fun (b1, b2, b3, b4, b5, b6, b7, b8) ->
│ let acc = 0 in
│ let acc = if b1 then acc lor 0b10000000 else acc in
│ let acc = if b2 then acc lor 0b01000000 else acc in
│ let acc = if b3 then acc lor 0b00100000 else acc in
│ …
│ acc)
│ (fun i ->
│ let b1 = i land 0b10000000 <> 0 in
│ let b1 = i land 0b01000000 <> 0 in
│ let b1 = i land 0b00100000 <> 0 in
│ …
│ (b1, b2, b3, b4, b5, b6, b7, b8))
│ uint8
└────
In general, data-encoding is probably slower than marshal, but its
strong points are:
• it offers some type guarantees,
• it gives you some control over the representation of the data,
• it allows you to define representations that are easy to parse in
other languages or in other versions of the same language,
• it generates documentation about the data-representation.
[Binary module of data-encoding]
<https://gitlab.com/nomadic-labs/data-encoding>
It there a tutorial for `js_of_ocaml' with simple graphics?
═══════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/it-there-a-tutorial-for-js-of-ocaml-with-simple-graphics/4636/7>
Deep in this thread, Phat Ky said
─────────────────────────────────
This is a really, really late reply but this youtube video was very
helpful to me … <https://www.youtube.com/watch?v=h_e5pPKI0K4>
Interesting OCaml exercises from François Pottier available online
══════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/interesting-ocaml-exercises-from-francois-pottier-available-online/7050/1>
gasche announced
────────────────
The recent URL
<https://ocaml-sf.org/learn-ocaml-public/#activity%3Dexercises>
contains auto-graded OCaml exercises, in particular a bunch of
advanced and fairly interesting exercices written by François Pottier,
which I would recommend for anyone knowledgeable in OCaml and curious
about algorithms and functional programming. (You have to scroll down
to see those, the exercises at the top come from the OCaml MOOC.)
See for example François' exercises on:
• [Alpha-Beta Search],
• [Parser combinators],
• [Huffman Compression],
• [Implementing backtracking with continuations], or
• my personal favorite, [reimplementing the core of a pretty-printer].
Context: the exercise platform is [LearnOCaml], initially written by
OCamlPro for the OCaml MOOC and maintaing by Yann Régis-Gianas
(@yurug) on behalf of the [OCaml Software Foundation]. We (at the
Foundation) are trying to assemble a corpus of nice OCaml exercises
for teachers and people self-studying, and the nice exercises by
François Pottier (@fpottier) were written as part of this initiative.
[Alpha-Beta Search]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/alpha_beta%26tab%3Dtext%26prelude%3Dshown>
[Parser combinators]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/parser_combinators%26tab%3Dtext>
[Huffman Compression]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/huffman%26tab%3Dtext%26prelude%3Dshown>
[Implementing backtracking with continuations]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/nondet_monad_cont%26tab%3Dtext%26prelude%3Dshown>
[reimplementing the core of a pretty-printer]
<https://ocaml-sf.org/learn-ocaml-public/exercise.html#id%3Dfpottier/pprint%26tab%3Dtext%26prelude%3Dshown>
[LearnOCaml] <https://github.com/ocaml-sf/learn-ocaml>
[OCaml Software Foundation] <http://ocaml-sf.org/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 29747 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-12-29 9:59 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-12-29 9:59 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 9463 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of December 22 to 29,
2020.
Table of Contents
─────────────────
ppx_deriving_yaml 0.1.0
A Heroku buildpack for OCaml
opam-dune-lint - keep opam and dune dependencies in sync
Scirep, a utility for literate programming
Camel Calendar for 2021
Old CWN
ppx_deriving_yaml 0.1.0
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ppx-deriving-yaml-0-1-0/7007/1>
Patrick Ferris announced
────────────────────────
I'm proud to announce the first release (and my first release) of
[ppx_deriving_yaml]. If you are familiar with the excellent
[ppx_deriving_yojson] then this library should come as no surprise. In
fact it helped me a lot in writing this ppx, so thank you to its
creators/maintainers.
[ppx_deriving_yaml] <https://github.com/patricoferris/ppx_deriving_yaml>
[ppx_deriving_yojson] <https://github.com/ocaml-ppx/ppx_deriving_yojson>
Installation
╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ $ opam update
│ $ opam install ppx_deriving_yaml
└────
Usage
╌╌╌╌╌
Ppx_deriving_yaml converts your OCaml types to the "basic" [OCaml Yaml
value type] (the one that is currently compatible with ezjsonm). So
for example you can have:
┌────
│ type t = { title: string; authors: string list } [@@deriving yaml]
│
│ let () =
│ let v = { title = "Yaml PPX!"; authors = [ "Patrick Ferris" ] } in
│ let yaml = to_yaml v in
│ Yaml.pp Format.std_formatter yaml;
│ match of_yaml yaml with
│ | Ok t -> Format.print_string t.title
│ | Error (`Msg m) -> failwith m
└────
The ppx generates two functions:
┌────
│ val of_yaml : Yaml.value -> t Yaml.res
│ val to_yaml : t -> Yaml.value
└────
And when built with this dune file:
┌────
│ (executable
│ (name main)
│ (libraries yaml)
│ (preprocess
│ (pps ppx_deriving_yaml)))
└────
The following output is generated:
┌────
│ title: Yaml PPX!
│ authors:
│ - Patrick Ferris
│ Yaml PPX!
└────
The [README] contains some more information and the library is still a
little rough around the edges, especially with error reporting, but
I'm currently using it in a few places such as an "ocaml-ified"
[github actions] library (ppx_deriving_yaml's [test workflow] was
automatically generated with it :sparkles:). This is a nice example of
how it can be used in a fairly straightforward way to generate OCaml
versions of the many projects that use Yaml for configuration files.
Happy yaml-ing :)
[OCaml Yaml value type]
<https://github.com/avsm/ocaml-yaml/blob/6de8fa6926d391334b945754619a64857d352e5d/lib/types.ml#L44>
[README]
<https://github.com/patricoferris/ppx_deriving_yaml#implementation-details>
[github actions] <https://github.com/patricoferris/opam-github-workflow>
[test workflow]
<https://github.com/patricoferris/ppx_deriving_yaml/blob/main/.github/workflows/test.yml>
A Heroku buildpack for OCaml
════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-a-heroku-buildpack-for-ocaml/7012/1>
roddy announced
───────────────
I wrote [a Heroku buildpack] for OCaml web apps that use opam/dune.
[a Heroku buildpack]
<https://github.com/roddyyaga/heroku-buildpack-ocaml>
opam-dune-lint - keep opam and dune dependencies in sync
════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-opam-dune-lint-keep-opam-and-dune-dependencies-in-sync/7014/1>
Thomas Leonard announced
────────────────────────
We're pleased to announce the first release of [opam-dune-lint]. This
little tool checks that every ocamlfind dependency listed in your
`dune' files has the corresponding opam package listed as a dependency
in your `*.opam' file(s).
e.g.
┌────
│ $ cd charrua
│ $ opam dune-lint
│ charrua-client.opam: changes needed:
│ "tcpip" {with-test & >= 6.0.0} [from test/client, test/client/lwt]
│ charrua-server.opam: changes needed:
│ "ppx_cstruct" {with-test & >= 6.0.0} [from (ppx), test]
│ "tcpip" {with-test & >= 6.0.0} [from test]
│ charrua-unix.opam: changes needed:
│ "cstruct-lwt" {>= 6.0.0} [from unix]
│ "ipaddr" {>= 5.0.1} [from unix]
│ "tcpip" {>= 6.0.0} [from unix]
│ charrua.opam: OK
│ Note: version numbers are just suggestions based on the currently installed version.
│ Write changes? [y] y
│ Wrote "./charrua-client.opam"
│ Wrote "./charrua-server.opam"
│ Wrote "./charrua-unix.opam"
└────
If your project generates the opam files from `dune-project', then it
will update your `dune-project' instead.
It can also be useful to run this in CI. It will exit with a non-zero
exit status if anything needs to be changed. [ocaml-ci] runs this
automatically as part of the "lint-opam" check.
[opam-dune-lint] <https://github.com/ocurrent/opam-dune-lint>
[ocaml-ci] <https://ci.ocamllabs.io/>
Scirep, a utility for literate programming
══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/scirep-a-utility-for-literate-programming/7016/1>
Philippe announced
──────────────────
I wrote a utility called [scirep] to render a markdown file with OCaml
code blocks as an HTML document, which provides some support for
graphics. Here are some examples of generated documents: [one based on
vg], and [another using owl-plplot].
It can also be used downstream of [mdx] as a markdown-to-html
converter that detects pictures in the toplevel's standard output and
renders them in the final document.
It is really a hack, and it is poorly documented, but I'm advertising
it in case it might be useful to others.
[scirep] <https://github.com/pveber/scirep>
[one based on vg] <http://pveber.github.io/scirep/fold.html>
[another using owl-plplot] <http://pveber.github.io/scirep/damped.html>
[mdx] <https://github.com/realworldocaml/mdx>
Camel Calendar for 2021
═══════════════════════
Archive: <https://discuss.ocaml.org/t/camel-calendar-for-2021/7020/1>
Florent Monnier announced
─────────────────────────
I would like to share with you a [camel calendar for 2021 in pdf] with
the nice theme from ocaml dot org.
It was generated from an ocaml script that you can find in this repo:
[svg calendar generator].
Several scripts are available, you can find some results on this [web
page].
At the beginning of 2020 I was searching for a free software to
generate calendars in SVG that I could customise for my own use, but I
was unable to install the Perl script that exists (it has a lot of
dependencies and the error message when I try to install it didn't
help us to find what's wrong with it).
This explains the design of these scripts, that are made to work
without any dependencies and without any compilation. There's code
duplication, but every script only need the ocaml interpreter to be
run, so most people comfortable with the command line should be able
to use it.
(I also tried to sell some [on Etsy] but didn't sold a single one.)
By default 12 languages are included in every script, but you can
generate the calendars for more than 200 languages if you use [these
dates locales] that come from the CLDR repository.
You can also switch monday first or sunday first.
These generators are provided under Zlib license.
I hope some will enjoy!
[camel calendar for 2021 in pdf]
<http://decapode314.free.fr/cal/cal-camel/cal-camel-2021-en.pdf>
[svg calendar generator] <https://github.com/fccm/ocaml-cal-svg>
[web page] <http://decapode314.free.fr/cal/>
[on Etsy] <https://www.etsy.com/fr/shop/Decapode>
[these dates locales] <https://github.com/fccm/DateLocale-ocaml>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 21680 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-12-15 9:51 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-12-15 9:51 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 20085 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of December 08 to 15,
2020.
Table of Contents
─────────────────
MirageOS 3.10 released
Exception vs Result
Release: scikit-learn, Numpy, Scipy for OCaml, 0.3.1
OCaml 4.10.2
BAP 2.2.0 Release
Liquidshop 1.0, Jan. 17th and 18th, 2021
Opium 0.20.0
Set up OCaml 1.1.5
Other OCaml News
Old CWN
MirageOS 3.10 released
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-mirageos-3-10-released/6941/1>
Hannes Mehnert announced
────────────────────────
we're pleased to announce MirageOS 3.10:
IPv6 and dual (IPv4 and IPv6) stack support
<https://github.com/mirage/mirage/pull/1187>
<https://github.com/mirage/mirage/issues/1190>
Since a long time, IPv6 code was around in our TCP/IP stack (thanks to
@nojb who developed it in 2014). Some months ago, @hannesm and
@MagnusS got excited to use it. After we managed to fix some bugs and
add some test cases, and writing more code to setup IPv6-only and dual
stacks, we are eager to share this support for MirageOS in a released
version. We expect there to be bugs lingering around, but duplicate
address detection (neighbour solicitation and advertisements) has been
implemented, and (unless "–accept-router-advertisement=false") router
advertisements are decoded and used to configure the IPv6 part of the
stack. Configuring a static IPv6 address is also possible (with
"–ipv6=2001::42/64").
While at it, we unified the boot arguments between the different
targets: namely, on Unix (when using the socket stack), you can now
pass "–ipv4=127.0.0.1/24" to the same effect as the direct stack: only
listen on 127.0.0.1 (the subnet mask is ignored for the Unix socket
stack).
A dual stack unikernel has "–ipv4-only=BOOL" and "–ipv6-only=BOOL"
parameters, so a unikernel binary could support both Internet Protocol
versions, while the operator can decide which protocol version to
use. I.e. now there are both development-time (stackv4 vs stackv6 vs
stackv4v6) choices, as well as the run-time choice (via boot
parameter).
I'm keen to remove the stackv4 & stackv6 in future versions, and
always develop with dual stack (leaving it to configuration & startup
time to decide whether to enable ipv4 and ipv6).
Please also note that the default IPv4 network configuration no longer
uses 10.0.0.1 as default gateway (since there was no way to unset the
default gateway <https://github.com/mirage/mirage/issues/1147>).
For unikernel developers, there are some API changes in the Mirage
module
• New "v4v6" types for IP protocols and stacks
• The ipv6_config record was adjusted in the same fashion as the
ipv4_config type: it is now a record of a network (V6.Prefix.t) and
gateway (V6.t option)
Some parts of the Mirage_key module were unified as well:
• Arp.ip_address is available (for a dual Ipaddr.t)
• Arg.ipv6_address replaces Arg.ipv6 (for an Ipaddr.V6.t)
• Arg.ipv6 replaces Arg.ipv6_prefix (for a Ipaddr.V6.Prefix.t)
• V6.network and V6.gateway are available, mirroring the V4 submodule
If you're ready to experiment with the dual stack: below is a diff for
our basic network example (from mirage-skeleton/device-usage/network)
replacing IPv4 with a dual stack, and the tlstunnel unikernel commit
<https://github.com/roburio/tlstunnel/commit/2cb3e5aa11fca4b48bb524f3c0dbb754a6c8739b>
changed tlstunnel from IPv4 stack to dual stack.
┌────
│ diff --git a/device-usage/network/config.ml b/device-usage/network/config.ml
│ index c425edb..eabc9d6 100644
│ --- a/device-usage/network/config.ml
│ +++ b/device-usage/network/config.ml
│ @@ -4,9 +4,9 @@ let port =
│ let doc = Key.Arg.info ~doc:"The TCP port on which to listen for
│ incoming connections." ["port"] in
│ Key.(create "port" Arg.(opt int 8080 doc))
│
│ -let main = foreign ~keys:[Key.abstract port] "Unikernel.Main" (stackv4
│ @-> job)
│ +let main = foreign ~keys:[Key.abstract port] "Unikernel.Main"
│ (stackv4v6 @-> job)
│
│ -let stack = generic_stackv4 default_network
│ +let stack = generic_stackv4v6 default_network
│
│ let () =
│ register "network" [
│ diff --git a/device-usage/network/unikernel.ml
│ b/device-usage/network/unikernel.ml
│ index 5d29111..1bf1228 100644
│ --- a/device-usage/network/unikernel.ml
│ +++ b/device-usage/network/unikernel.ml
│ @@ -1,19 +1,19 @@
│ open Lwt.Infix
│
│ -module Main (S: Mirage_stack.V4) = struct
│ +module Main (S: Mirage_stack.V4V6) = struct
│
│ let start s =
│ let port = Key_gen.port () in
│ - S.listen_tcpv4 s ~port (fun flow ->
│ - let dst, dst_port = S.TCPV4.dst flow in
│ + S.listen_tcp s ~port (fun flow ->
│ + let dst, dst_port = S.TCP.dst flow in
│ Logs.info (fun f -> f "new tcp connection from IP %s on port %d"
│ - (Ipaddr.V4.to_string dst) dst_port);
│ - S.TCPV4.read flow >>= function
│ + (Ipaddr.to_string dst) dst_port);
│ + S.TCP.read flow >>= function
│ | Ok `Eof -> Logs.info (fun f -> f "Closing connection!");
│ Lwt.return_unit
│ - | Error e -> Logs.warn (fun f -> f "Error reading data from
│ established connection: %a" S.TCPV4.pp_error e); Lwt.return_unit
│ + | Error e -> Logs.warn (fun f -> f "Error reading data from
│ established connection: %a" S.TCP.pp_error e); Lwt.return_unit
│ | Ok (`Data b) ->
│ Logs.debug (fun f -> f "read: %d bytes:\n%s" (Cstruct.len b)
│ (Cstruct.to_string b));
│ - S.TCPV4.close flow
│ + S.TCP.close flow
│ );
│
│ S.listen s
└────
Other bug fixes include <https://github.com/mirage/mirage/issues/1188>
(in <https://github.com/mirage/mirage/pull/1201>) and adapt to charrua
1.3.0 and arp 2.3.0 changes
(<https://github.com/mirage/mirage/pull/1199>).
Exception vs Result
═══════════════════
Archive: <https://discuss.ocaml.org/t/exception-vs-result/6931/18>
Continuing this thread, Vladimir Keleshev announced
───────────────────────────────────────────────────
A bit late to the party, but here's an overview of error handling
methods that I did a while ago:
[Composable Error Handling in OCaml (keleshev.com)]
It compares the following approaches:
• Exceptions
• Result type with strings for errors
• Result type with custom variants for errors
• Result type with polymorphic variants for errors
[Composable Error Handling in OCaml (keleshev.com)]
<https://keleshev.com/composable-error-handling-in-ocaml>
Release: scikit-learn, Numpy, Scipy for OCaml, 0.3.1
════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-release-scikit-learn-numpy-scipy-for-ocaml-0-3-1/6942/1>
Ronan Le Hy announced
─────────────────────
I've just released an update of OCaml wrappers for scikit-learn:
• documentation: <https://lehy.github.io/ocaml-sklearn/>
• code: <https://github.com/lehy/ocaml-sklearn>
• `opam install sklearn'
These bindings also come with bindings for Numpy (`opam install np')
and Scipy (`opam install scipy').
Scikit-learn is all of these things:
• Simple and efficient tools for predictive data analysis
• Accessible to everybody, and reusable in various contexts
• Built on NumPy, SciPy, and matplotlib
• Open source, commercially usable - BSD license
Scikit-learn is robust, well-engineered and covers most basic machine
learning use cases. As a professional data scientist I use it
extensively from Python. I built these wrappers because I felt
challenged by my friend @UnixJunkie's funny R wrappers.
I don't depend personally on these packages and maintain/improve them
without any guarantees. They have many unpolished corners. However,
they have tests and I don't expect them to add too many bugs to
scikit-learn. Contributions and bug reports are welcome (but be aware
that the bindings are generated from a big hairy Python script).
Many thanks to everybody involved in opam!
OCaml 4.10.2
════════════
Archive: <https://discuss.ocaml.org/t/ann-ocaml-4-10-2/6945/1>
octachron announced
───────────────────
The OCaml team has the pleasure of celebrating the birthday of Grace
Hopper by announcing the release of OCaml version 4.10.2.
This exceptional release makes OCaml 4.10 available on the new
macOS/arm64 platform, and fixes some compatibility issues for the
mingw64 and FreeBSD/amd64 platform.
If OCaml 4.10.1 already works on your platform of choice, this release
should be completely transparent to you (and can be safely ignored).
Note that those fixes were backported from OCaml 4.12: further
improvement to the support of the macOS/arm64 platform will happen on
the 4.12 branch.
The release is available as a set of OPAM switches, and as a source
download here:
<https://github.com/ocaml/ocaml/archive/4.10.2.tar.gz>
<https://caml.inria.fr/pub/distrib/ocaml-4.10/>
OCaml 4.10.2
╌╌╌╌╌╌╌╌╌╌╌╌
• [9938], [9939]: Define __USE_MINGW_ANSI_STDIO=0 for the mingw-w64
ports to prevent their C99-compliant snprintf conflicting with
ours. (David Allsopp, report by Michael Soegtrop, review by Xavier
Leroy)
[9938] <https://github.com/ocaml/ocaml/issues/9938>
[9939] <https://github.com/ocaml/ocaml/issues/9939>
◊ Supported platforms:
• [9699], [10026]: add support for iOS and macOS on ARM 64 bits
Backported from OCaml 4.12.0 (GitHub user @EduardoRFS, review by
Xavier Leroy, Nicolás Ojeda Bär and Anil Madhavapeddy, additional
testing by Michael Schmidt)
[9699] <https://github.com/ocaml/ocaml/issues/9699>
[10026] <https://github.com/ocaml/ocaml/issues/10026>
◊ Code generation and optimization
• [9752], [10026]: Revised handling of calling conventions for
external C functions. Provide a more precise description of the
types of unboxed arguments, so that the ARM64 iOS/macOS calling
conventions can be honored. Backported from OCaml 4.12.0 (Xavier
Leroy, review by Mark Shinwell and Github user @EduardoRFS)
• [9969], [9981]: Added mergeable flag tqo ELF sections containing
mergeable constants. Fixes compatibility with the integrated
assembler in clang 11.0.0. Backported from OCaml 4.12.0 (Jacob
Young, review by Nicolás Ojeda Bär)
[9752] <https://github.com/ocaml/ocaml/issues/9752>
[10026] <https://github.com/ocaml/ocaml/issues/10026>
[9969] <https://github.com/ocaml/ocaml/issues/9969>
[9981] <https://github.com/ocaml/ocaml/issues/9981>
Anil Madhavapeddy
─────────────────
There is also a [macos/arm64 binary of opam] available from the
releases page for your convenience, and opam repository has been
updated to understand the new tier-1 constraints imposed by macos/arm
(i.e. the only working compilers there are 4.10.2 and 4.12.0~dev, and
`opam init' will now do the right thing).
There will be a number of packages that are broken due to the shift to
`/opt/homebrew' from `/usr/local' for Homebrew/ARM (due to the need to
keep them simultaneously installed on the same Mac), so please feel
free to submit PRs to opam-repository to fix this stuff.
We'll shortly have Mac (both Intel and ARM) testing up and running on
opam-repository, so CI will catch up with reality once more, thanks to
furious hacking by @patricoferris to extend our ocurrent-based CI
infrastructure to support the unique vagaries of the Mac environment
(notably, a total lack of native containers). We have it working
locally, and are just upstreaming it now.
[macos/arm64 binary of opam]
<https://github.com/ocaml/opam/releases/tag/2.0.7>
BAP 2.2.0 Release
═════════════════
Archive: <https://discuss.ocaml.org/t/ann-bap-2-2-0-release/6950/1>
Ivan Gotovchits announced
─────────────────────────
We are proud to announce the 2.2.0 release of the Carnegie Mellon
University [Binary Analysis Platform]. BAP is the framework and
toolkit for analyzing programs in their machine code
representation. This update has a lot of [new features] despite that
originally it was more as a maintenance version. Special thanks to
@XVilka and [@Phosphorus15] for contributing Thumb/ThumbV2 lifter and
radare2 integration. We would also like to thank [ForAllSecure] for
open-sourcing and contributing to us their x86 floating-point
lifter. The new version of BAP is also much more efficient and we now
have a much better symbolization facility (so we're no longer really
dependent on the presence of external tools). Another nice addition is
a new REPL powered by [ocaml-linenoise], see the demo below.
<https://asciinema.org/a/358996>
[Binary Analysis Platform]
<https://github.com/BinaryAnalysisPlatform/bap>
[new features]
<https://github.com/BinaryAnalysisPlatform/bap/releases/tag/v2.2.0>
[@Phosphorus15] <https://github.com/Phosphorus15>
[ForAllSecure] <https://forallsecure.com/>
[ocaml-linenoise] <https://github.com/ocaml-community/ocaml-linenoise>
Liquidshop 1.0, Jan. 17th and 18th, 2021
════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-liquidshop-1-0-jan-17th-18th-2021/6951/1>
Romain Beauxis announced
────────────────────────
We are happy to announce that we'll be holding Liquidshop 1.0 these
coming Jan. 17th & 18th, our first ever (online) conference and
workshops on liquidsoap and other related technologies and projects!
Liquidsoap is a statically typed scripting language with specialized
primitives and operators for creating media streams used for media
processing, online streaming and a lot more. It is written in OCaml
and has been maintained for over a decade now.
We will have 3 different tracks for the event, namely:
• Showcases: short presentations about a website / radio / art
installation that you built using Liquidsoap or other related tools
• Tech talks: in-depth presentation of a technology related to
Liquidsoap and streaming in general
• Workshops: user-centered freeform discussions about your project or
issues around Liquidsoap and streaming
If you're interested to participate, wether as an attendee or a
presenter, make sure to register via our website at:
<http://www.liquidsoap.info/liquidshop/> or directly via the form
available at: <https://forms.gle/HdGNLz5qM3HVU1ub7>
We are super excited for this event. We have already secured a couple
of interesting speakers and we would love to get to know the community
better, see what y'all are doing with liquidsoap and other releated
projects, community radios, live video, weird installations, etc. and
meet with everyone.
Also, if you have any suggestion about the best technical solutions to
organize such an event, we'd be happy to hear about them.
Finally, if any of y'all have some specific topics to discuss and
would like to learn more about liquidsoap, this will be a great place
to connect!
Opium 0.20.0
════════════
Archive: <https://discuss.ocaml.org/t/ann-opium-0-20-0/6955/1>
Thibaut Mattio announced
────────────────────────
I'm pleased to announce a new version of [Opium] web framework
(0.20.0) is available on Opam.
Here's the changelog:
[Opium] <https://github.com/rgrinberg/opium>
Added
╌╌╌╌╌
• New `Auth' module to work with `Authorization' header ([#238])
• New `basic_auth' middleware to protect handlers with a `Basic'
authentication method ([#238])
• New `Response.of_file' API for conveniently creating a response of a
file ([#244])
• Add a package `opium-graphql' to easily create GraphQL server with
Opium ([#235])
• Add a function `App.run_multicore' that uses pre-forking and spawns
multiple processes that will handle incoming requests ([#239])
[#238] <https://github.com/rgrinberg/opium/pull/238>
[#244] <https://github.com/rgrinberg/opium/pull/244>
[#235] <https://github.com/rgrinberg/opium/pull/235>
[#239] <https://github.com/rgrinberg/opium/pull/239>
Fixed
╌╌╌╌╌
• Fix reading cookie values when multiple cookies are present in
`Cookie' header ([#246])
Happy hacking :slight_smile:
[#246] <https://github.com/rgrinberg/opium/pull/246>
Set up OCaml 1.1.5
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-5/6971/1>
Sora Morimoto announced
───────────────────────
This release reduces build time by up to 2 minutes by exporting
modified `OPAMJOBS' environment variable.
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.5>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Memthol: exploring program profiling]
• [Growing the Hardcaml toolset]
• [ Editor Plugin for VSCode and Vim Officially Released!]
• [Announcing Our Market Prediction Kaggle Competition]
• [Every proof assistant: introducing homotopy.io – a proof assistant
for geometrical higher category theory]
[OCaml Planet] <http://ocaml.org/community/planet/>
[Memthol: exploring program profiling]
<https://www.ocamlpro.com/2020/12/01/memthol-exploring-program-profiling/>
[Growing the Hardcaml toolset]
<https://blog.janestreet.com/growing-the-hardcaml-toolset-index/>
[ Editor Plugin for VSCode and Vim Officially Released!]
<https://rescript-lang.org/blog/editor-support-release-1-0>
[Announcing Our Market Prediction Kaggle Competition]
<https://blog.janestreet.com/announcing-our-market-prediction-kaggle-competition-index/>
[Every proof assistant: introducing homotopy.io – a proof assistant for
geometrical higher category theory]
<http://math.andrej.com/2020/11/24/homotopy-io/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 36981 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-12-01 8:54 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-12-01 8:54 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 22326 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of November 24 to
December 01, 2020.
Table of Contents
─────────────────
drom.0.2.0: OCaml Project Manager, beta release
OCaml on the BEAM webinar
ocaml-lsp-server 1.3.0
OCaml User Survey 2020
http-cookie 2.0.0
reparse 2.0.0
VSCode OCaml Platform v1.5.0
Database modelling
Opium 0.19.0
Operator lookup tool for OCaml
Other OCaml News
Old CWN
drom.0.2.0: OCaml Project Manager, beta release
═══════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-drom-0-2-0-ocaml-project-manager-beta-release/6841/1>
Fabrice Le Fessant announced
────────────────────────────
I am happy to announce the first release of `drom', version 0.2.0, a
tool to create and manage OCaml projects. `drom' is a simple layer on
top of `opam' and `dune', with project and package descriptions
written in TOML syntax. It is an attempt at providing a `cargo'-like
experience for developers, with builtin support for standard OCaml
tools (`opam', `dune', `odoc', etc.) and source managers (Github for
now, with Github Actions and Github Pages).
There are mainly 2 use-cases of `drom':
• Scafolding tool: `drom' makes it easy to create OCaml projects by
generating all the files needed for a standard OCaml project. It
creates files for `opam' and `dune', formatters (`ocp-index' and
`ocamlformat'), documentation (`sphinx' and `odoc'), testing
directories and Github CI. Once these files have been created,
`drom' is not needed anymore and you can keep using your preferred
tools.
• Management tool: `drom' can also be used to keep managing the
project afterwards. It has commands like `drom build' to build the
project, automatically installing a local switch with all needed
dependencies, `drom doc' to generate the documentation and `drom
test' to execute tests. `drom' works as a simple interface over
`opam' and `dune' so you almost never need to use them directly.
<https://ocamlpro.github.io/drom>
(this site and the documentation was mostly generated by `drom'
itself)
`drom' is available in the official opam repository.
Examples:
┌────
│ $ drom new mylib --skeleton library // generate library project
│ // or
│ $ drom new hello // generate program project
│
│ $ cd hello
│ $ emacs drom.toml // edit the project description
│ $ drom project // update files
│ $ drom build // create local switch and build
│ // or
│ $ drom build --switch 4.10.0 // use global switch and build
│ $ ./hello // run the executable
│ $ drom test // run tests
│ $ drom install // install in opam switch
└────
This is an early release to get feedback from users. `drom' has been
tested on several of our internal projects, like `opam-bin' and
`ez_file'.
Since `drom' creates local `opam' switches for every project by
default (though it is possible to use global switches too), it is
advised to use it with `opam-bin' to speed up switch creation and
upgrades.
`drom' works by creating projects using "skeletons", i.e. project and
package templates. `drom' comes with a few predefined skeletons
(`program' or `library'), and allows users to add their own
skeletons. We will of course extend the substitution language to help
users develop such new skeletons.
`drom' is a collaborative work between OCamlPro and Origin Labs.
François Bobot asked and Fabrice Le Fessant replied
───────────────────────────────────────────────────
I'm very happy to see work in the OCaml world in that
direction. I was currently looking for duniverse for that
kind of need. Do they fullfil different needs or how do
they compare?
My understanding is that `duniverse' tackles the problem of the
"mono-repo", i.e. when you want to manage many different projects as
just one project, using `dune' capacity to build them all at once. I
would say that `drom' tackles an orthogonal problem, which is to
simplify the creation of simple OCaml projects (generating all the
standard files you need, like Makefile, dune-project, dune,
.ocamlformat, .github CI, documentation, license, etc.) and day-to-day
management (changing dependencies, having a copy of headers that you
can insert in new files, etc.). It also provides a single interface
over basic opam/dune commands.
It would probably be possible to use `duninverse' on a set of projects
containing projects generated by `dune', but I don't know enough about
`duniverse' to be sure.
Of course, `drom' can manage projects composed of multiple libraries
and executables (called `packages' because `drom' generates one `opam'
file for every one of them), but I wouldn't call that a mono-repo,
it's just frequent to have more than one package in a small project.
OCaml on the BEAM webinar
═════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-on-the-beam-webinar/6851/1>
Yawar Amin announced
────────────────────
Erlang Solutions is going to do a webinar on Leandro Ostera's new BEAM
backend for OCaml:
<https://www2.erlang-solutions.com/webinar-registration-2>
Should be exciting!
ocaml-lsp-server 1.3.0
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocaml-lsp-server-1-3-0/6856/1>
Rudi Grinberg announced
───────────────────────
On behalf of the ocaml-lsp team, I’d like to announce version 1.3.0.
This release an improvement in keyword completion and a new code
action. Keywords are now filtered by the context the user requested
the completion, and there's a new code action to quickly populate .mli
files with the the inferred types from the .ml file.
OCaml User Survey 2020
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocaml-user-survey-2020/6624/28>
Xavier Leroy announced
──────────────────────
Here is a summary and analysis of the survey results I wrote on behalf
of the OCaml Software Foundation:
<https://www.dropbox.com/s/omba1d8vhljnrcn/OCaml-user-survey-2020.pdf?dl=0>
Enjoy!
http-cookie 2.0.0
═════════════════
Archive: <https://discuss.ocaml.org/t/ann-http-cookie-2-0-0/6866/1>
Bikal Lem announced
───────────────────
A new version of `cookies' package - now named `http-cookie'- has been
released to opam. This version has been rewritten to remove all its
external and ppx dependencies and now only depends on stock ocaml and
its stdlib.
`http-cookie' is a [RFC 6265] compliant HTTP cookie library. RFC 6265
is a HTTP cookie standard specifying cookie data validity
requirements.
Additionally, I have also removed the use of `Result.t' from the
previous version and have used plain old exceptions to denote any
cookie data validation errors.
• [Github - http-cookie]
• [Docs - http-cookie]
[RFC 6265] <https://tools.ietf.org/html/rfc6265>
[Github - http-cookie] <https://github.com/lemaetech/http-cookie>
[Docs - http-cookie] <https://lemaetech.co.uk/http-cookie/>
reparse 2.0.0
═════════════
Archive: <https://discuss.ocaml.org/t/ann-reparse-2-0-0/6868/1>
Bikal Lem announced
───────────────────
A new version of `reparse' 2.0.0 has been released to opam.
Reparse is a monadic, recursive descent based, comprehensive, parser
construction library for ocaml.
CHANGES for version 2.0.0:
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Rewrite the whole package to use exceptions rather than `result'
type
• Adds many more parsing combinators
• Adds comprehensive unit tests
• Adds comprehensive documentation, host documentation and add links
in repo home page
• Adds abstraction for input source
• Provides unix file source and string input source
• Adds separate package `reparse-unix' for unix file input
• Adds calc.ml and json.ml in examples.
Additionally, the API is now comprehensively documented with at least
an example for each API call.
• [Github Reparse]
• [API Docs]
[Github Reparse] <https://github.com/lemaetech/reparse>
[API Docs] <https://lemaetech.co.uk/reparse/>
VSCode OCaml Platform v1.5.0
════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-vscode-ocaml-platform-v1-5-0/6871/1>
Max Lantas announced
────────────────────
We are happy to announce the v1.5.0 release of [VSCode OCaml
Platform], a Visual Studio Code extension for OCaml. It is available
on the [VSCode Marketplace] and [Open VSX Registry].
This release has the following changes:
• Highlight `rec' keyword in OCaml mli files for recursive modules
([#434])
• Highlight `cram' stanza in dune-project files ([#441])
• Fix reason highlighting of let extensions ([#447])
• Improve highlighting of Menhir new syntax ([#450])
• Improve Menhir syntax highlighting ([#455])
• Add `Alt + P' keyboard shortcut for infer interface code action
([#448])
• Infer interface when switching to a non-existing interface file
([#437])
This is the first release to be automatically published to Open VSX,
which will benefit users of [VSCodium] and other editors.
Please feel free to share feedback.
[VSCode OCaml Platform]
<https://github.com/ocamllabs/vscode-ocaml-platform>
[VSCode Marketplace]
<https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform>
[Open VSX Registry]
<https://open-vsx.org/extension/ocamllabs/ocaml-platform>
[#434] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/434>
[#441] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/441>
[#447] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/447>
[#450] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/450>
[#455] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/455>
[#448] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/448>
[#437] <https://github.com/ocamllabs/vscode-ocaml-platform/pull/437>
[VSCodium] <https://github.com/VSCodium/vscodium>
Database modelling
══════════════════
Archive: <https://discuss.ocaml.org/t/database-modelling/1150/2>
Reviving this very old thread, paul announced
─────────────────────────────────────────────
And a version for postgresql:
<https://github.com/pat227/ocaml-pgsql-model.git>
Opium 0.19.0
════════════
Archive: <https://discuss.ocaml.org/t/ann-opium-0-19-0/6876/1>
Thibaut Mattio announced
────────────────────────
On behalf of the Opium team, I am pleased to announce a new version of
Opium (`0.19.0') is available on Opam.
This release comes with a complete rewrite of Opium's internals to
switch from Cohttp to Httpaf (work done by @anuragsoni).
As demonstrated in several benchmarks, Httpaf's latency is much lower
than Cohttp's in stress tests, so it is expected that Opium will
perform better in these high-pressure situations.
The underlying HTTP server implementation is now contained in a `rock'
package, that provides a Service and Filter implementation, inspired
by Finagle's. The architecture is similar to Ruby's Rack library
(hence the name), so one can compose complex web applications by
combining Rock applications.
The `rock' package offers a very slim API, with very few dependencies,
so it should be an attractive option for other Web frameworks to build
on, which would allow the re-usability of middlewares and handlers,
independently of the framework used (e.g. one could use Sihl
middlewares with Opium, and vice versa).
Apart from the architectural changes, this release comes with a lot of
additional utilities and middlewares which should make Opium a better
candidate for complex web applications, without having to re-write a
lot of common Web server functionalities.
The Request and Response modules now provide:
• JSON encoders/decoders with `Yojson'
• HTML encoders/decoders with `Tyxml'
• XML encoders/decoders with `Tyxml'
• SVG encoders/decoders with `Tyxml'
• multipart/form encoders/decoders with `multipart_form_data'
• urlencoded encoders/decoders with `Uri'
And the following middlewares are now built-in:
• `debugger' to display an HTML page with the errors in case of
failures
• `logger' to log requests and responses, with a timer
• `allow_cors' to add CORS headers
• `static' to serve static content given a custom read function
(e.g. read from S3)
• `static_unix' to serve static content from the local filesystem
• `content_length' to add the `Content-Length' header to responses
• `method_override' to replace the HTTP method with the one found in
the `_method' field of `application/x-www-form-urlencoded' encoded
`POST' requests.
• `etag' to add `ETag' header to the responses and send an HTTP code
`304' when the computed ETag matches the one specified in the
request.
• `method_required' to filter the requests by the HTTP method and
respond with an HTTP code `405' if the method is not allowed.
• `head' to add supports for `HEAD' request for handlers that receive
`GET' requests.
Lastly, this release also adds a package `opium-testing' that can be
used to test Opium applications with Alcotest. It provides `Testable'
modules for every Opium types, and implements helper functions to
easily get an `Opium.Response' from an `Opium.Request'.
As this release changes the API drastically, we will keep maintaining
the `0.18.0' branch for bug fixes, for users who don't want to (or
can't) migrate to `0.19.0'.
What's next?
╌╌╌╌╌╌╌╌╌╌╌╌
Recent discussions have shown that building optimized applications was
not trivial. This is partly due to the lack of documentation, and
probably because some configurations that should come by default, are
left to the user to optimize. Therefore, we will keep performance in
mind for the next release and investigate the current bottlenecks in
Opium.
We will also continue adding higher-level functionalities to Opium to
make users productive with real-world applications. This includes:
• Sessions support (with signed cookies)
• Handlers for authentication
• Adding more middlewares (compression, flash messages, caching, etc.)
Your feedback is welcome, don't hesitate to open Issues on Github!
Andreas Poisel asked and Anurag Soni replied
────────────────────────────────────────────
Does Opium + Httpaf support TLS?
It doesn't at the moment.
Calascibetta Romain then said
─────────────────────────────
According the interface of `opium', it's possible to have the support
of TLS (with `ocaml-tls') with the [new version of Conduit] and
[`paf'] (which is a MirageOS compatible layer of HTTP/AF -
unreleased):
┌────
│ let stack ip =
│ Tcpip_stack_socket.UDPV4.connect (Some ip) >>= fun udpv4 ->
│ Tcpip_stack_socket.TCPV4.connect (Some ip) >>= fun tcpv4 ->
│ Tcpip_stack_socket.connect [ ip ] udpv4 tcpv4
│
│ let http_with_conduit (ip, port) error_handler request_handler =
│ Paf.https httpaf_config ~error_handler ~request_handler:(fun _ -> request_handler)
│ ({ Paf.TCP.stack= stack ip
│ ; keepalive= None
│ ; nodelay= false
│ ; port= port}, Tls.Config.server ~certificates ())
│
│ let () = match Lwt_main.run (Opium.run (https_with_conduit (Ipaddr.V4.localhost, 4343)) opium_app) with
│ | Ok () -> ()
│ | Error err -> Fmt.epr "%a.\n%!" Conduit_mirage.pp_error err
└────
I used it for a long time on my personal unikernels and did some tests
to ensure that [it does fails when it handles many requests]. Note
that you are able to use OpenSSL too if you want.
[new version of Conduit]
<https://discuss.ocaml.org/t/ann-new-release-of-conduit/6611>
[`paf'] <https://github.com/dinosaure/paf-le-chien/>
[it does fails when it handles many requests]
<https://github.com/dinosaure/paf-le-chien/pull/12>
Robin Björklin also replied
───────────────────────────
If you want to use this new version of Opium there are ways around
this problem. You could have Haproxy (or similar) terminate your TLS
connections externally and if your environment requires TLS for your
internal network something like [Consul Connect] can cover that
use-case for you.
[Consul Connect]
<https://learn.hashicorp.com/tutorials/consul/get-started-service-networking?in=consul/getting-started>
Operator lookup tool for OCaml
══════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-operator-lookup-tool-for-ocaml/6882/1>
Craig Ferguson announced
────────────────────────
I'm pleased to announce the initial release of
craigfe.io/operator-lookup/, a search tool for OCaml operators and
syntax elements:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/e/ee41569b4426c9b77fd6d367e50ff5ac759f4e46_2_1034x558.png>
For each operator, the tool provides a short explanation of its
behaviour, examples of usage and warnings of common misuses and
misunderstandings:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/8/879ae652a8895fa0258bc288c8d0c819cb9ef314_2_920x1000.png>
The intent of writing this tool was to give OCaml beginners a quick
way to find the standard / conventional operators in the language and
to disambiguate "operator-like" syntax that can be hard to search for
otherwise. It currently supports:
• all standard library operators,
• conventional infix operators (`>>=', `>>|', `>|='),
• binding operators (`let+', `let*', `and+', etc.),
• syntax that is often confused for an operator (`#', `;;').
Please let me know if you have any suggestions for improvements. I
hope you find it useful!
Acknowledgements
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
This tool is heavily based on the [JavaScript operator lookup] utility
by [Josh Comeau]. Thanks to him for the initial idea and for allowing
me to re-use his design elements.
[JavaScript operator lookup]
<https://www.joshwcomeau.com/operator-lookup/>
[Josh Comeau] <https://twitter.com/JoshWComeau>
Kakadu asked and Craig Ferguson replied
───────────────────────────────────────
It's not obvious for me are these operators hardcoded or
do you scan opam packages from time to time?
They're hardcoded. The operators fall into three classes:
• The vast majority of them are from the `Stdlib' module, so I don't
expect those to change very regularly.
• A small number of "conventional" operators used in the community
(`>>=', `let*', etc.). Even for that small set there is some
divergence in Opam – c.f. `>>|' vs `>|=' for a _map_ operator – so I
suspect there are not many other candidates for this group.
• There are a few regexes behind the scenes for catching valid
operator names that don't fall into the first two
categories. e.g. many search terms are classified as "_a
left-associative operator_" with a correspondingly vague
description.
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [“Universal” Dune Tip: Rebuild Stuff, Sometimes]
[OCaml Planet] <http://ocaml.org/community/planet/>
[“Universal” Dune Tip: Rebuild Stuff, Sometimes]
<https://seb.mondet.org/b/0009-dune-universe-hack.html>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 39166 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-11-03 15:15 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-11-03 15:15 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 32510 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of October 27 to
November 03, 2020.
Table of Contents
─────────────────
Brr 0.0.1, a toolkit for programming browsers
New release of Monolith (20201026)
MirageOS 3.9.0 released
An AST typing problem
erlang 0.0.14, a toolkit to manipulate Erlang sources
opam-bin.1.0.0: binary packages for opam
Interesting OCaml Articles
Old CWN
Brr 0.0.1, a toolkit for programming browsers
═════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-brr-0-0-1-a-toolkit-for-programming-browsers/6608/9>
Continuing this thread, Daniel Bünzli said
──────────────────────────────────────────
One thing I forgot, is that there is a [todomvc] example in the repo,
see `todomvc.{html,ml}' in [this directory].
It doesn't use the UI toolkit you mentioned, just the basic reactive
DOM support provided by [`Brr_note'] and [`Brr_note_kit']. But you can
see how quickly you get reusable and composable components like
[`bool_editor'] and [`string_editor'].
The program structure in that example is quite similar to the one I
had in the drawing app. You define a purely functional, non reactive
[data model], [actions] over the data model, create small UI fragments
that renders parts of your data model and generate actions events for
it, gradually glue them together using note combinators and finally
define a [fixed point signal] that holds the data model as massaged by
the actions events of your UI (as mentioned I'd like to replace fix
points by direct `let rec' and a lazy infinitesimal delay combinator).
There are a few pitfalls like you should avoid retaining parts of your
data model in the UI otherwise you could get outdated data come back
in your model (makes for very fun and spooky bugs though). Identity
in the data model is also a bit tricky, it seems in todomvc I [used]
`=='. That didn't work in the drawing app where my surfaces had
properties that could be updated but they could also be linked
toghether (that window belongs to that wall etc.) so I needed stable
identifiers for which I introduced a little abstraction to identify
values and define relations between them.
One thing I remember fondly when doing the drawing app is that I would
still get the odd interaction glitches you get when coding direct
mouse manipulation interactions (surface
definition/selection/move/transform) however thanks to the ability to
denotationally reason and act (left leaning [`E.select']) on the
simultaneity of events, they were easy to understand and fix in an
explicit way (that is via a defining *expression*).
Also if you get into [`Note'] the denotational semantics notation is
not yet explained there, refer to the [one of react] it's the same.
[todomvc] <http://todomvc.com/>
[this directory] <https://github.com/dbuenzli/brr/tree/master/test>
[`Brr_note'] <https://erratique.ch/software/brr/doc/Brr_note/index.html>
[`Brr_note_kit']
<https://erratique.ch/software/brr/doc/Brr_note_kit/index.html>
[`bool_editor']
<https://github.com/dbuenzli/brr/blob/41580885f40bfd184c3d8e5be2ddd56b0712b411/test/todomvc.ml#L229>
[`string_editor']
<https://github.com/dbuenzli/brr/blob/41580885f40bfd184c3d8e5be2ddd56b0712b411/test/todomvc.ml#L213-L214>
[data model]
<https://github.com/dbuenzli/brr/blob/41580885f40bfd184c3d8e5be2ddd56b0712b411/test/todomvc.ml#L36>
[actions]
<https://github.com/dbuenzli/brr/blob/41580885f40bfd184c3d8e5be2ddd56b0712b411/test/todomvc.ml#L101>
[fixed point signal]
<https://github.com/dbuenzli/brr/blob/41580885f40bfd184c3d8e5be2ddd56b0712b411/test/todomvc.ml#L314-L324>
[used]
<https://github.com/dbuenzli/brr/blob/41580885f40bfd184c3d8e5be2ddd56b0712b411/test/todomvc.ml#L84>
[`E.select']
<https://erratique.ch/software/note/doc/Note/E/index.html#val-select>
[`Note'] <https://erratique.ch/software/note/doc/Note/>
[one of react]
<https://erratique.ch/software/react/doc/React/index.html#sem>
Yoann Padioleau asked and Daniel Bünzli replied
───────────────────────────────────────────────
How hard would it be to build on top of Brr_note something
like an Elm Architecture-style toolkit? I know there's a
TEA-Bucklescript library, but I'd rather use something
relying on dune/jsoo.
I've read somewhere else that you were a bit skeptical
about the advantage of MVU (movel-view-update) over MVC,
but I personnaly find the counter UI example in ELM at
<https://guide.elm-lang.org/architecture/buttons.html> far
simpler than the corresponding one in Brr at
<https://github.com/barko/brr-eg/blob/master/counter/counter.ml>
I don't know. I didn't look into MVU too much, but to me it's largely
a remix of MVC – despite what its proponents try to tell you. Since we
now live in an age of software adverstising it's a bit hard to get
frank assessments.
As far as I'm concerned the compositionality story of MVU doesn't look
great. Basically it enforces state machines on you, and composing
state machines is a bit meh. In FRP state machines become signals (via
`S.accum') which are highly composable entities with *fine
granularity* (and bonus point, a well defined denotational semantics
for equational reasoning).
If you are looking for MVU I think you can simply jump on [LexiFI's
vdom]. But when I see how you get to [compose two models] in that
paradigm, I'm not convinced.
There’s no need for those E.select. The UI is IMHO more
declarative in ELM.
That example could be rewritten (I didn't write the examples in this
repo) to be more like the ELM one in it's declarations.
But I think the ELM example is also more rigid. You may not like that
`E.select' on this toy example, but you may get to enjoy it you when
you start composing larger systems from smaller components.
[LexiFI's vdom] <https://github.com/LexiFi/ocaml-vdom>
[compose two models]
<https://github.com/LexiFi/ocaml-vdom/blob/9c5e42888ba72e69d5a018e38a4633e400913bfb/examples/demo/demo.ml#L196-L223>
Yaron Minsky then said
──────────────────────
You might be interested in Bonsai! At some level, you can think of it
as a library for building composable state machines. It uses
[Incremental] as its engine for incrementalizing the computation of
views, with a virtual-dom implementation underneath.
<https://github.com/janestreet/bonsai>
It's the primary tool we use for building UIs inside of Jane Street.
In some ways, Bonsai is like Elm, but it has its own interesting
ideas. Some of the concepts are borrowed from this paper:
<https://www.cl.cam.ac.uk/~jdy22/papers/the-arrow-calculus.pdf>
though I won't pretend to understand this paper myself!
Bonsai doesn't yet have enough public-facing documentation, and really
the bleeding edge version on github is considerably better and more
usable than the one released into opam. But there's at least one
public-facing UI that's built with it, if you want a real-world
example.
<https://blog.janestreet.com/finding-memory-leaks-with-memtrace/>
[Incremental] <https://github.com/janestreet/incremental>
Yoann Padioleau replied
───────────────────────
Thx for the links!
The memtrace viewer example is pretty cool, but Bonsai looks far more
complicated than ELM. If you look at the counter example (the hello
world of UI), here:
<https://github.com/janestreet/bonsai/blob/master/examples/counters/lib/bonsai_web_counters_example.ml>
and you compare it to the one in ocaml-vdom (thx @dbuenzli for the
link) at
<https://github.com/LexiFi/ocaml-vdom/blob/master/examples/counters/counters.ml>
there's a huge difference in simplicity.
Ty Overby then said
───────────────────
Hi Aryx, I wrote the Bonsai example that you linked, and it certainly
isn't the most concise, but that's because it was built for a tutorial
on building small components (one counter is a single component), how
to use more advanced combinators (Bonsai.assoc), and how to move data
from one component to another (the add_counter_component into the
associated counters component.) I think it's a great example of the
power of structuring an UI as a DAG rather than a tree, but it
definitely doesn't make for the most concise code!
In the example, the comments that look like "CODE_EXCERPT_BEGIN" are
actually preprocessor definitions that are used in the (honestly,
kinda out of date) [tutorial here]. A bonsai app that wasn't written
for such a tutorial would look more like [this].
[tutorial here]
<https://github.com/janestreet/bonsai/blob/master/docs/getting_started/open_source/counters.mdx>
[this]
<https://gist.github.com/TyOverby/e0f7e944d002cdf7144aaf0102d16ed5>
New release of Monolith (20201026)
══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-new-release-of-monolith-20201026/6667/1>
François Pottier announced
──────────────────────────
It is my pleasure to announce a major new release of Monolith.
┌────
│ opam update && opam install monolith
└────
Monolith offers facilities for testing an OCaml library (for instance,
a data structure implementation) by comparing it against a reference
implementation. It can be used to perform either random testing or
fuzz testing. Fuzz testing relies on the external tool afl-fuzz.
More information on Monolith is available [here] and in the draft
paper [Strong Automated Testing of OCaml Libraries].
[here] <https://gitlab.inria.fr/fpottier/monolith>
[Strong Automated Testing of OCaml Libraries]
<http://cambium.inria.fr/~fpottier/publis/pottier-monolith-2021.pdf>
MirageOS 3.9.0 released
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-mirageos-3-9-0-released/6668/1>
Martin Lucina announced
───────────────────────
We are pleased to announce the release of MirageOS 3.9.0.
Our last release announcement was for [MirageOS 3.6.0], so we will
also cover changes since 3.7.x and 3.8.x in this announcement.
New features:
• The Xen backend has been [re-written from scratch] to be based on
Solo5, and now supports PVHv2 on Xen 4.10 or higher, and QubesOS
4.0.
• As part of this re-write, the existing Mini-OS based implementation
has been retired, and all non-UNIX backends now use a unified OCaml
runtime based on `ocaml-freestanding'.
• OCaml runtime settings settable via the `OCAMLRUNPARAM' environment
variable are now exposed as unikernel boot parameters. For details,
refer to [#1180].
Security posture improvements:
• With the move to a unified Solo5 and ocaml-freestanding base
MirageOS unikernels on Xen gain several notable improvements to
their overall security posture such as SSP for all C code, W^X, and
malloc heap canaries. For details, refer to the mirage-xen 6.0.0
release [announcement].
API breaking changes:
• Several Xen-specific APIs have been removed or replaced, unikernels
using these may need to be updated. For details, refer to the
mirage-xen 6.0.0 release [announcement].
Other notable changes:
• `Mirage_runtime' provides event loop enter and exit hook
registration ([#1010]).
• All MirageOS backends now behave similarly on a successful exit of
the unikernel: they call `exit' with the return value 0, thus
`at_exit' handlers are now executed ([#1011]).
• The unix backend used a toplevel exception handler, which has been
removed. All backends now behave equally with respect to exceptions.
• Please note that the `Mirage_net.listen' function still installs an
exception handler, which will be removed in a future release. The
out of memory exception is no longer caught by `Mirage_net.listen'
([#1036]).
• To reduce the number of OPAM packages, the `mirage-*-lwt' packages
are now deprecated. `Mirage_net' (and others) now use `Lwt.t'
directly, and their `buffer' type is `Cstruct.t' ([#1004]).
• OPAM files generated by `mirage configure' now include opam build
and installation instructions, and also an URL to the Git `origin'
([#1022]).
Known issues:
• `mirage configure' fails if the unikernel is under version control
and no `origin' remote is present ([#1188]).
• The Xen backend has issues with event delivery if built with an
Alpine Linux GCC toolchain. As a work-around, please use a Fedora or
Debian based toolchain.
Acknowledgements:
• Thanks to Roger Pau Monné, Andrew Cooper and other core Xen
developers for help with understanding the specifics of how Xen
PVHv2 works, and how to write an implementation from scratch.
• Thanks to Marek Marczykowski-Górecki for help with the QubesOS
specifics, and for forward-porting some missing parts of PVHv2 to
QubesOS version of Xen.
• Thanks to @palainp on Github for help with testing on QubesOS.
[MirageOS 3.6.0] <https://mirage.io/blog/announcing-mirage-36-release>
[re-written from scratch] <https://github.com/mirage/mirage/issues/1159>
[#1180] <https://github.com/mirage/mirage/pull/1180>
[announcement]
<https://github.com/mirage/mirage-xen/releases/tag/v6.0.0>
[#1010] <https://github.com/mirage/mirage/pull/1010>
[#1011] <https://github.com/mirage/mirage/pull/1011>
[#1036] <https://github.com/mirage/mirage/issues/1036>
[#1004] <https://github.com/mirage/mirage/issues/1004>
[#1022] <https://github.com/mirage/mirage/pull/1022>
[#1188] <https://github.com/mirage/mirage/issues/1188>
An AST typing problem
═════════════════════
Archive: <https://discuss.ocaml.org/t/an-ast-typing-problem/3677/8>
Chet Murthy announced
─────────────────────
This note discusses the beginnings of an OCaml attribute-grammar
evaluator generator. You can find this code on github at
`camlp5/pa_ppx_ag'.
All of this code is implemented using `camlp5' and the `pa_ppx' suite
of PPX rewriters.
Caveat: this code is less than a week old, so it's changing fast. In
the unlkely event that anybody out there is actually interested in
using this code, I'm happy to help in any way I can. But just be
aware that it's changing -really- fast.
Attribute Grammars for the multipass AST analysis problem
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
A year-and-a-half ago, the OP "An AST Typing Problem"
(<https://discuss.ocaml.org/t/an-ast-typing-problem/3677>) raised the
problem of how to deal with ASTs, in the presence of multiple passes
of program-analysis, each of which will want to hang various bits of
data off nodes. The author of the OP pointed also at a couple of
posts on Lambda-the-Ultimate (LtU), discussing related problems.
The author notes:
There’s a lot of passes, many of which depend on the
previous ones, each one making some slight change to the
AST which might or might not result in having to walk
through the whole AST to catch all occurrences of that
particular node. Clearly you’ll want to encode semantic
errors in the types, so each pass ends up having its own
unique AST, each depending on the previous one. To change
a single node deep in the AST I have to write about a
hundred lines of types and mapping functions’ worth of
boilerplate. Any change in the lower levels of the AST
bubbles up to the higher ones, and refactoring becomes a
nightmare.
I've been thinking about this problem ever since, and at the time, had
suggested that while it seemed like attribute-grammars might be a
workable solution, they were a pretty heavy hammer. It doesn't help
(of course) that there exist no attribute-grammar evaluator
generators, for OCaml. Also, at least in the LtU threads, there was
discussion of modifying the AST, and having the analyses automatically
be updated for the modified AST. Obviously this would require an
incremental re-attribution algorithm: more complexity and again,
something that isn't implemented for OCaml.
But imagine that there existed an attribute-grammar evaluator
generator for OCaml. So for a simple language of expressions, with an
assignment-operator, we could write an evaluator as an
attribute-grammar. Imagine that you could write an ast like this
(test1_ast.ml):
┌────
│ type expr =
│ INT of int
│ | BINOP of binop * expr * expr
│ | UNOP of unop * expr
│ | REF of string
│ | ASSIGN of string * expr
│ | SEQ of expr * expr
│ and unop = UPLUS | UMINUS
│ and binop = PLUS | MINUS | STAR | SLASH | PERCENT
│ and prog = expr
└────
and then (having elsewhere written parser/pretty-printer) declare
attributes on those types (test1_variants.ml):
┌────
│ module Attributed = struct
│ [%%import: Test1_ast.expr]
│ [@@deriving attributed {
│ attributed_module_name = AT
│ ; normal_module_name = OK
│ ; attributes = {
│ expr = {
│ inh_env = [%typ: (string * int) list]
│ ; syn_env = [%typ: (string * int) list]
│ ; value_ = [%typ: int]
│ }
│ ; prog = {
│ value_ = [%typ: int]
│ }
│ ; binop = {
│ oper = [%typ: int -> int -> int]
│ }
│ ; unop = {
│ oper = [%typ: int -> int]
│ }
│ }
│ }]
│ end
└────
and then declare attribute equations (test1_ag.ml):
┌────
│ module REC = struct
│ [%%import: Test1_variants.Attributed.AT.expr]
│ [@@deriving ag {
│ module_name = AG
│ ; storage_mode = Records
│ ; axiom = prog
│ ; attributes = {
│ expr = {
│ inh_env = [%typ: (string * int) list]
│ ; syn_env = [%typ: (string * int) list]
│ ; value_ = [%typ: int]
│ }
│ ; prog = {
│ value_ = [%typ: int]
│ }
│ ; binop = {
│ oper = [%typ: int -> int -> int]
│ }
│ ; unop = {
│ oper = [%typ: int -> int]
│ }
│ }
│ ; attribution = {
│ expr__INT = (
│ [%nterm 0].syn_env := [%nterm 0].inh_env ;
│ [%nterm 0].value_ := [%prim 1].intval
│ )
│ ; expr__BINOP = (
│ [%nterm expr.(1)].inh_env := [%nterm expr].inh_env ;
│ [%nterm expr.(2)].inh_env := [%nterm expr.(1)].syn_env ;
│ [%nterm expr].syn_env := [%nterm expr.(2)].syn_env ;
│ [%nterm expr].value_ := [%nterm binop.(1)].oper [%nterm expr.(1)].value_ [%nterm
│ expr.(2)].value_
│ )
│ ; expr__UNOP = (
│ [%nterm expr.(1)].inh_env := [%nterm expr].inh_env ;
│ [%nterm expr].syn_env := [%nterm expr.(1)].syn_env ;
│ [%nterm expr].value_ := [%nterm unop.(1)].oper [%nterm expr.(1)].value_
│ )
│ ; expr__REF = (
│ [%nterm 0].syn_env := [%nterm 0].inh_env ;
│ [%nterm 0].value_ := List.assoc [%prim 1].stringval [%nterm 0].inh_env
│ )
│ ; expr__ASSIGN = (
│ [%nterm 0].syn_env := ([%prim 1].stringval, [%nterm expr.(1)].value_) :: [%nterm
│ expr.(1)].syn_env ;
│ [%nterm expr.(1)].inh_env := [%nterm 0].inh_env ;
│ [%nterm 0].value_ := [%nterm expr.(1)].value_
│ )
│ ; expr__SEQ = (
│ [%nterm 1].inh_env := [%nterm 0].inh_env ;
│ [%nterm 2].inh_env := [%nterm 1].syn_env ;
│ [%nterm 0].syn_env := [%nterm 2].syn_env ;
│ [%nterm 0].value_ := [%nterm 2].value_
│ )
│ ; prog = (
│ [%nterm 1].inh_env := [] ;
│ [%nterm 0].value_ := [%nterm 1].value_ ;
│ assert True
│ )
│ ; unop__UPLUS = (
│ [%nterm unop].oper := fun x -> x
│ )
│ ; unop__UMINUS = (
│ [%nterm unop].oper := fun x -> (- x)
│ )
│ ; binop__PLUS = (
│ [%nterm binop].oper := (+)
│ )
│ ; binop__MINUS = (
│ [%nterm binop].oper := (-)
│ )
│ ; binop__STAR = (
│ [%nterm binop].oper := fun a b -> a*b
│ )
│ ; binop__SLASH = (
│ [%nterm binop].oper := (/)
│ )
│ ; binop__PERCENT = (
│ [%nterm binop].oper := (mod)
│ )
│ }
│ }]
│ end
└────
and then, turning a crank, you would get an evaluator:
┌────
│ let test_records ctxt =
│ assert_equal 3 ({| x := 1 ; x ; y := 2 ; x + y |} |> pa_prog_attributed |> REC.AG.evaluate)
│ ; assert_equal 0 ({| x := 1 ; y := 2 ; x / y |} |> pa_prog_attributed |> REC.AG.evaluate)
└────
where `pa_prog_attributed' is a parser that parses the surface syntax
into an AST, which has empty slots for all attributes, and
`REC.AG.evaluate' evaluates attributes in its argument AST, and then
returns a tuple of all the synthesized attributes of the root node.
Retaining familiar surface syntax for pattern-matching and constructing ASTs
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Now, we don't want to give up easy pattern-matching and construction
of the AST, just because the AST has attributes strewn throughout it.
But we don't have to: with Camlp5's "quotations", once we define a
surface syntax parser for the basic AST (unadorned with attributes –
viz. `test1_ast.ml'), we can use that to bootstrap ourselves to a
surface syntax parser for expressions and patterns over that AST, and
then in a similar manner we can get them for the AST adorned with
attributes.
This has already been done for hashconsed ASTs, and ASTs with built-in
unique-IDs, and and doing it for "attributed ASTs" isn't any harder.
Those examples can be found in the github project
`camlp5/pa_ppx_q_ast'.
Limitations
╌╌╌╌╌╌╌╌╌╌╌
There are still limitations.
1. The current code only implements topological-order evaluation.
That is, it builds the entire dependency-graph, topologically-sorts
it, and then evaluates attributes. This is …. suboptimal, when we
well know that almost all interesting AGs are already in the class
of ordered attribute-grammars (OAGs). I plan to implement the OAG
evaluation strategy next.
2. Traditionally AGs are defined over "productions" which are
sequences of nonterminals and terminals. This doesn't correspond
to the way we define OCaml constructor data-types. So instead of a
constructor like
┌────
│ type expr =
│ ... | Call of name * arg_list
│ and arg_list = NoArgs | SomeArgs of expr * arg_list
└────
we might want to use ~ 'a list~
┌────
│ type expr =
│ ... | Call of name * expr list
└────
Problem is: defining attribute-equations for (effectively) an array
of nodes, is not part of the standard lingo of AGs. But I believe
we can invent new syntax and make this succinct.
3. Storage optimization. A naive implementation of AGs can store all
attributes ever computed, at all the nodes in the AST. This can
use a lot of memory. But there are well-known techniques to
discard attributes once they'll never more be needed in the rest of
the attribute-evaluation, and I plan to implement these techniques.
There's an entire literature on things like remote-references in
attribute grammars, aggregates, and other things, all of which can
probably be usefully employed.
Conclusion
╌╌╌╌╌╌╌╌╌╌
I think that attribute-grammars could be a useful way to structure
complex multipass program-analysis, just as they used to do back in
the good ol' days.
Maybe worth a look-see!
erlang 0.0.14, a toolkit to manipulate Erlang sources
═════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-erlang-0-0-14-a-toolkit-to-manipulate-erlang-sources/6694/1>
ostera announced
────────────────
Hej, hope you're staying safe :raised_hands:
I'm excited to share with you the first release of `erlang'.
*tl;dr*: _parser/lexer/ast/printer for Erlang_
Description
╌╌╌╌╌╌╌╌╌╌╌
`erlang' is a toolkit for manipulating Standard Erlang and Core Erlang
sources and their abstract syntax trees according to the Erlang
specifications.
Version 0.0.14 provides:
• A lexer/parser written in Menhir for Standard Erlang
• ASTs for Core Erlang and Standard Erlang
• An AST helper module for constructing Standard Erlang programs
• A printer for the Standard Erlang AST (of highly volatile
prettiness)
• Support to turn ASTs to S-expressions
• `erldump', a binary tool for reading Erlang sources and printing
their concrete syntax trees as S-expressions.
It is distributed under Apache-2.0 license, depends on Menhir and
Cmdliner, and it is being developed as part of the Caramel project.
• *PR*: <https://github.com/ocaml/opam-repository/pull/17553> – should
be on opam.ocaml.org sometime tomorrow :)
• *Homepage*: <https://github.com/AbstractMachinesLab/caramel>
• *Install*: `opam install erlang'
• *API Docs & manuals*: maybe on next release, but _follow the types_,
and the `Erlang.Ast_helper' module is modeled after the
`Parsing.Ast_helper' so it should feel familiar.
I started writing `erlang' to let Caramel do an entirely symbolic
compilation from the OCaml typedtree that would still allow for other
passes/checks to be made cleanly. It's come with a decent number of
tests, and it can parse some OTP modules with small modifications.
There's [a few outstanding issues] regarding the parsing for the next
release, but it should be a starting point for anyone wanting to read
sources and _do something_ with them. I plan on cover these issues in
the rest of the year, but as with all open source, it may take longer.
I'd like to add a few other things, like an AST invariants module to
check that ASTs are actually valid Erlang programs, and
transformations more suitable for static analyses of the sources.
My thanks go to @antron, @c-cube, @Drup, @rgrinberg, and @mseri for
helping me get around the OCaml compiler, Menhir, and eventually to
get this version split from Caramel and released independently. Also
a shoutout to the Js_of_ocaml project that served as a starting point
for the parser/lexer work here.
If you can give me some feedback on the design and implementation, I'd
very much like to hear your thoughts :slight_smile:
For those of you hoping to start using it, _do not_ let it crash.
[a few outstanding issues]
<https://github.com/AbstractMachinesLab/caramel/issues?q=is%3Aissue+is%3Aopen+label%3Alib%3Aerlang>
opam-bin.1.0.0: binary packages for opam
════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-opam-bin-1-0-0-binary-packages-for-opam/6696/1>
Fabrice Le Fessant announced
────────────────────────────
I am happy to announce the first stable release of `opam-bin', version
1.0.0, a framework to CREATE, USE and SHARE binary relocatable
packages with opam, to speed-up installation of packages. It is easily
installable from opam-repository, and available on Github:
<https://ocamlpro.github.io/opam-bin>
With opam-bin, you can :
• build binary packages while installing their source counterpart with
opam
• automatically reuse previously created binary packages instead of
compiling them again
• export and share your binary packages as part of opam repositories
for other users/computers to use
`opam-bin' is a framework in 3 parts :
• a tool `opam-bin' to create binary packages:
<https://ocamlpro.github.io/opam-bin>
• a set of patches to make some packages relocatable (`opam-bin' will
apply them automatically when building packages), including patches
to make the OCaml distribution relocatable from version 4.02.0 to
4.11.1: <https://github.com/ocamlpro/relocation-patches>
• a set of contributed repositories of binary packages. For now, there
is only one contribution, during the summer, by Origin Labs :
<https://www.origin-labs.com/opam-bin/debian10.4-amd64/> containing
5 repos, among which the "4.10.0" repo contains more than 1800
packages. These repos can be used DIRECTLY WITH opam, WITHOUT USING
opam-bin.
This is the first stable release:
• Specific support has been added in the current `master' branch of
`opam' to make working with this version more convenient, by
printing pre- and post- installation messages. Yet, it will still
work with previous version of opam, but with no output on the
terminal when calling opam.
• The `sharing' option can be enabled to share files with hard-links
between switches, making the creation of new local switches almost
costless in time and disk space.
`opam-bin' is a collaborative work between OCamlPro and Origin Labs.
`opam-bin' is particularly useful if you create many local switches,
as they become unexpensive. Tools like Drom (an OCaml project
scaffolder, <https://ocamlpro.github.io/drom>) can take advantage of
that to provide a cargo-like experience.
Interesting OCaml Articles
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/interesting-ocaml-articles/1867/63>
Ryan Slade announced
────────────────────
Anyone who's been following this blog probably saw this coming:
<https://blog.darklang.com/leaving-ocaml/>
It's an interesting read and hopefully can be used as constructive
criticism in order to improve the state of the OCaml ecosystem.
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 53584 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-10-27 8:43 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-10-27 8:43 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 18183 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of October 20 to 27,
2020.
Table of Contents
─────────────────
Bisect_ppx, the coverage tool, now has excellent integration with Dune
Js_of_ocaml in the VSCode OCaml Platform
Training Sessions for "Fast Track to OCaml" and "Expert OCaml" in Paris (23-26 November 2020)
Set up OCaml 1.1.2
Set up OCaml 1.1.3
First release of FSML
Qrc 0.1.0, a QR code encoder
cumulus 0.0.1
Brr 0.0.1, a toolkit for programming browsers
Old CWN
Bisect_ppx, the coverage tool, now has excellent integration with Dune
══════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/bisect-ppx-the-coverage-tool-now-has-excellent-integration-with-dune/6634/1>
Anton Bachin announced
──────────────────────
[*Bisect_ppx*], the coverage tool, has just had its [2.5.0] release,
in which the main addition is a very neat integration with Dune:
┌────
│ dune runtest --instrument-with bisect_ppx --force
└────
This uses the new [instrumentation support] added in Dune 2.7.0, and
is a considerable improvement over the dubious methods Bisect and its
users were previously forced to rely on :)
It is no longer necessary to edit `dune' files for a release, as
Bisect only becomes a dependency of your project when
`--instrument-with bisect_ppx' is supplied on the Dune command line,
which is only during development and in CI. This makes projects ready
for release from any commit. Dune also now knows to rebuild affected
files when instrumentation is turned on or off, so you don't have to
manually run `dune clean' in between. Everything just works the way it
should.
See the updated [instructions] for all the details on how to use this
integration.
I've also adapted [Lambda Soup] as a simple full-project example. See
its [`opam'], [`dune-project'], [`dune'], and [`Makefile'].
Bisect_ppx still supports all the older integrations, so if you have
an existing setup, you don't have to edit it. Support may eventually
be removed in the future, however, so I encourage users to gradually
update.
See the full [changelog] for information on bugs fixed by the release.
Thanks to the Dune team for adding `--instrument-with', to @undu for
supporting it on the Bisect side, and to all the Bisect_ppx users and
contributors!
Happy testing!
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/1/1911adc6af898b6f4efd7dc69d2c1f90699031ba.gif>
<https://github.com/aantron/bisect_ppx>
[*Bisect_ppx*] <https://github.com/aantron/bisect_ppx>
[2.5.0] <https://github.com/aantron/bisect_ppx/releases/tag/2.5.0>
[instrumentation support]
<https://dune.readthedocs.io/en/stable/instrumentation.html?highlight=instrument-with>
[instructions] <https://github.com/aantron/bisect_ppx#Dune>
[Lambda Soup] <https://github.com/aantron/lambdasoup>
[`opam']
<https://github.com/aantron/lambdasoup/blob/a0cbf54bf9affda00455c54369e473b905458114/lambdasoup.opam#L17-L22>
[`dune-project']
<https://github.com/aantron/lambdasoup/blob/master/dune-project#L1>
[`dune']
<https://github.com/aantron/lambdasoup/blob/a0cbf54bf9affda00455c54369e473b905458114/src/dune#L7>
[`Makefile']
<https://github.com/aantron/lambdasoup/blob/a0cbf54bf9affda00455c54369e473b905458114/Makefile#L15>
[changelog] <https://github.com/aantron/bisect_ppx/releases/tag/2.5.0>
Js_of_ocaml in the VSCode OCaml Platform
════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/js-of-ocaml-in-the-vscode-ocaml-platform/6635/1>
Max LANTAS announced
────────────────────
I just finished a write-up about [vscode-ocaml-platform]'s recent
transition to Js_of_ocaml:
<https://mnxn.github.io/blog/ocaml/vscode-jsoo/>
I can answer any questions here.
This is also my first technical blog post, so any constructive
criticism or comments about my writing would be very helpful.
[vscode-ocaml-platform]
<https://github.com/ocamllabs/vscode-ocaml-platform/>
Training Sessions for "Fast Track to OCaml" and "Expert OCaml" in Paris (23-26 November 2020)
═════════════════════════════════════════════════════════════════════════════════════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2020-10/msg00018.html>
Laurène Gibaud announced
────────────────────────
At OCamlPro, we will be organizing 2 cross-company training sessions
in French. Both sessions interleave theory and practice. You'll have
time to ask your specific questions and get personalized feedback on
your programs.
• Our Beginner session will allow developers to build upon their
experience of other programming languages (such as C, C++, Python,
C# or Java) to program confidently in OCaml. Feel free to share the
info with your coworkers or your network!
• Our “Expert OCaml” training will allow you to master OCaml’s
advanced features such as its type-system, OCaml’s open source tools
and libraries, and how to write compact and efficient code.
More info on the program and prerequisites on
<http://www.ocamlpro.com/training-ocamlpro/> or ask away (answer this
email or write at contact@ocamlpro.com).
When? The Beginner session is scheduled for November 23-24, 2020. The
Expert session will be on November 25-26, 2020.
Where? Paris 14, in OCamlPro's office.
How? Register on:
<https://www.ocamlpro.com/pre-inscription-a-une-session-de-formation-inter-entreprises/>
We can also organize custom and on-site sessions upon request.
Set up OCaml 1.1.2
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-2/6643/1>
Sora Morimoto announced
───────────────────────
This release contains these changes:
• Add the Cygwin setup to a known location for later steps
• Check if the switch exists before creating the switch
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.2>
Set up OCaml 1.1.3
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-3/6644/1>
Sora Morimoto announced
───────────────────────
This release contains these changes:
• Update the `@actions/core' package to address [CVE-2020-15228]
<https://github.com/avsm/setup-ocaml/releases/tag/v1.1.3>
[CVE-2020-15228] <https://github.com/advisories/GHSA-mfwh-5m23-j46w>
First release of FSML
═════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-fsml/6645/1>
jserot announced
────────────────
This is to announce the first public release of FSML, an OCaml library
for describing and describing synchronous finite state machines.
FSML is a simplified version of the library provided in the [Rfsm]
package for which
• the system is composed of a single FSM
• this FSM has a single, implicit, triggering event (typically called
the *clock* , hence the term *synchronous* used in the description)
The FSML library provides
• a type `Fsm.t' for describing FSMs
• possibly having *local variables*
• for which *transitions* , implicitely triggered by a clock, are
defined by a set of *boolean guards* and a set of *actions*
• a set of PPX extensions for building values of type `Fsm.t'
• functions for producing and viewing graphical representations of
FSMs in the `.dot' format
• functions for saving and reading FSM representations in files using
the JSON format
• functions for performing single or multi-step simulations of FSMs
and generating trace files in the `.vcd' format to be viewed by VCD
viewers such as [gtkwave]
• functions for generating C or VHDL code from a FSM representation
(for integration into existing
code and/or simulation)
FSML is available from [Github] or as an [OPAM package].
[Rfsm] <http://github.com/jserot/rfsm>
[gtkwave] <http://gtkwave.sourceforge.net/>
[Github] <https://github.com/jserot/fsml>
[OPAM package] <https://opam.ocaml.org/packages/fsml>
Qrc 0.1.0, a QR code encoder
════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-qrc-0-1-0-a-qr-code-encoder/6647/1>
Daniel Bünzli announced
───────────────────────
QR codes are unsightly – a mirror of their specification. But they
enable all sorts of neat tricks now that scanners for them are in many
pockets.
Qrc generate them:
Qrc encodes your data into QR codes. It has built-in QR
matrix renderers for SVG, ANSI terminal and text.
Qrc is distributed under the ISC license. It has no
dependencies.
Homepage: <https://erratique.ch/software/qrc>
API docs: <https://erratique.ch/software/qrc/doc/> or `odig doc qrc'
Install: `opam install qrc'
cumulus 0.0.1
═════════════
Archive: <https://discuss.ocaml.org/t/ann-cumulus-0-0-1/6655/1>
Petter A. Urkedal announced
───────────────────────────
I would like to announce a new FRP library built on the React library.
The purpose of [cumulus] is to help organize code which work on
differential updates. The main type is the *cumulus signal*, which is
analogous to a react signal, except that information about the
difference from the previous value is provided to consumers along with
the new value, when the cumulus signal changes.
So, why does a cumulus signal provide both the state and the
difference to downstream signals? That is, what is the difference
between the following:?
┌────
│ type t1 = state * change React.E (* initial value and even of changes *)
│ type t2 = (state, change) Cumulus.t (* the cumulus signal *)
└────
The former type presumes that after the consumer has received the
initial state, it will only need to know what changes on successive
updates. This seems quite natural. It works well if, for instance,
we want to reconstruct a signal holding a set of strings, given an
initial set and a series of additions and removals:
┌────
│ module String_set = Set.Make (String)
│
│ type 'a set_patch = [`Add of string | `Remove of string]
│ type 'a update = 'a -> 'a
│
│ let patch_string_set : string set_patch -> String_set.t update = function
│ | `Add x -> String_set.add x
│ | `Remove x -> String_set.remove x
│
│ let integrate_strings (init, changes) =
│ React.E.fold (fun l p -> patch_string_set p l) init changes
└────
But what if we want to maintain a signal holding the intersection of
two sets of strings? If we try to lift the intersection operation to
work on patches, we discover that learning about the addition of an
element to left-hand set is not sufficient to determine whether the
element shall the added to the resulting set; we also need to know
whether the element is a member of the right-hand set. So, in this
case we would instead use cumulus signals:
┌────
│ let cu : (String_set.t, string set_patch) Cumulus.t = ...
│ let cv : (String_set.t, string set_patch) Cumulus.t = ...
│ let cuv =
│ let init u v = String_set.inter u v in
│ let patch (u, du) (v, dv) r' =
│ (match du, dv with
│ | None, Some x when String_set.mem x u ->
│ Cumulus.Patch (String_set.add x r', `Add1 x)
│ ...)
│ in
│ Cumulus.l2 ~init ~patch cu cv
└────
For the complete example, using integers instead of strings, see
[`test_isecn.ml'] from the testsuite.
(Footnote: If consumers know how to integrate the states they depend
on, they could in principle keep their own record of the full states
of the arguments. But this would be inefficient if there are many
consumers, and there is also a simplification of code and possibly
improved abstraction in letting the producer maintain its own state.)
Formally, we can understand the difference between `t1' and `t2' in
terms of calculus. For instance, the differential of a product
`d(x·y) = dx·y + x·dy' contains a mix of both the differentials and
values of the two variables. But if the expression is linear, only
differentials will will occur: `d(a·x + b·y + c) = a·dx + b·dy'. So,
when `t1' is sufficient, we are dealing with the analogue of a linear
function. The above example could be turned into a linear one by
making `Labels.t' a multiset type and considering the multiset union
operation.
Thus far we only considered purely functional code, but a cumulus
signal may chose to modify and return the same physical state during
an update. Also note when designing the differential component of the
cumulus signal, that we may exploit the fact the consumers also may
inspect the corresponding new state. Combining these two points, a
cumulus signal holding an array might have the type `('a array, [`Set
of int | `Resize of int])'. Here the state may be reused for ``Set'
and replaced for ``Resize'.
On a related not, there is also the [reactiveData] library which deals
with (linear) patching of containers.
I must also mention that there there is an [OCaml project with the
same name] (except casing). Sorry for not checking thoroughly in
advance. I hope it is not an issue in practise, otherwise there is
still time to rename while the library is fresh.
[cumulus] <https://github.com/paurkedal/ocaml-cumulus/>
[`test_isecn.ml']
<https://github.com/paurkedal/ocaml-cumulus/blob/master/tests/test_isecn.ml>
[reactiveData] <https://github.com/ocsigen/reactiveData>
[OCaml project with the same name] <https://github.com/Cumulus/Cumulus>
Brr 0.0.1, a toolkit for programming browsers
═════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-brr-0-0-1-a-toolkit-for-programming-browsers/6608/5>
Continuing this thread, Yoann Padioleau asked Daniel Bünzli replied
───────────────────────────────────────────────────────────────────
What are the differences with the default bindings
provided in js_of_ocaml to the browser APIs (e.g., js.mli,
dom.mli, etc.)?
I'm not sure exactly what you are asking but:
1. If you are asking about the way API are exposed: `brr' does not
type JavaScript's objects as phantom types. It simply relies on
OCaml's abstract data types and plain functions. More about this
can be found in brr's [FFI manual] and [FFI cookbook].
2. If you are asking about binding coverage, you should be able to get
a sense of what is bound in `brr' [here].
Regarding 2. `brr''s coverage of more recent browser APIs is broader
and more consistent than in `js_of_ocaml' – Promise support, Fetch,
Service workers, Media capture APIs, WebGL2, Webcrypto, WebAudio,
etc. Conversly older APIs supported in `js_of_ocaml' may not supported
in `brr' (e.g. XMLHTTPRequest). Besides `brr''s coverage of some of
the DOM *element-specific* interfaces may be shallower than in
`js_of_ocaml'. There is however good coverage for the
[`HTMLMediaElement'], [`HTMLCanvasElement'], [`HTMLFormElement'] and
[`HTMLInputElement'] interfaces. For the rest the [attribute and
property API] and the occasional trivial FFI method binding should be
able to get you a long way.
[FFI manual] <https://erratique.ch/software/brr/doc/ffi_manual.html>
[FFI cookbook] <https://erratique.ch/software/brr/doc/ffi_cookbook.html>
[here] <https://erratique.ch/software/brr/doc/index.html#supported_apis>
[`HTMLMediaElement']
<https://erratique.ch/software/brr/doc/Brr_io/Media/index.html#el>
[`HTMLCanvasElement']
<https://erratique.ch/software/brr/doc/Brr_canvas/Canvas/index.html>
[`HTMLFormElement']
<https://erratique.ch/software/brr/doc/Brr_io/Form/index.html>
[`HTMLInputElement']
<https://erratique.ch/software/brr/doc/Brr/El/index.html#ifaces>
[attribute and property API]
<https://erratique.ch/software/brr/doc/Brr/El/index.html#ats_and_props>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 35020 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-10-20 8:15 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-10-20 8:15 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 22169 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of October 13 to 20,
2020.
Table of Contents
─────────────────
Dialo is hiring frontend and backend OCaml developers (Remote)
Progress 0.1.0
Brr 0.0.1, a toolkit for programming browsers
New release of Conduit
Easy cross compilation using esy
OCaml User Survey 2020
Old CWN
Dialo is hiring frontend and backend OCaml developers (Remote)
══════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/dialo-is-hiring-frontend-and-backend-ocaml-developers-remote/6604/1>
Wojtek Czekalski announced
──────────────────────────
[Dialo] is an early stage company with an experienced founding
team. Assembling a team that consists of the best and brightest is our
top priority. In the immediate term we are building a visual
programming language for conversational AI. Our long term vision is
that personalized contact we are enabling will cause deeper
relationships between users and businesses and turn all interactions
into a unified long term customer journey.
The work is quite demanding when it comes to both ideation and
implementation. We are aiming to provide a room for growth both
technically and/or as a leader. For current open source maintainers we
are willing to sponsor your work on OSS for 20% of time.
We use OCaml for frontend and backend (along with Python for machine
learning, natural language processing). We are hiring people for
different positions. Both people with extensive experience and
newcomers are encouraged to apply. We try to find the sharpest people
rather than checking boxes with particular skills.
The official job posting:
<https://dialo.recruitee.com/o/software-developer-ocamlreason> We are
also hiring for two other (related) positions:
• <https://dialo.recruitee.com/o/software-developer-frontend>
• <https://dialo.recruitee.com/o/software-developer-backend>
[Dialo] <https://dialo.ai>
Progress 0.1.0
══════════════
Archive: <https://discuss.ocaml.org/t/ann-progress-0-1-0/6607/1>
Craig Ferguson announced
────────────────────────
I'm pleased to announce the first release of [`Progress'], now
available on Opam.
<https://raw.githubusercontent.com/CraigFe/progress/main/.meta/example.svg>
`Progress' is a small library for quickly defining and using progress
bars in OCaml programs. It aims to provide the following:
• support for rendering multiple progress bars simultaneously;
• responds dynamically to changes in terminal size;
• allows user-defined progress bar layouts.
[`Progress'] <https://github.com/CraigFe/progress/>
Defining your own progress bars
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The example animation above uses a pre-provided progress bar layout
that should meet many needs ([`Progress_unix.counter']), but it's
fairly easy to re-define it ourselves using the low-level
[`Progress.Segment'] API:
┌────
│ let counter filename =
│ let proportion i = Int64.to_float i /. 1_000_000. in
│ let open Progress in
│ Segment.(
│ list
│ [
│ const filename;
│ Units.bytes of_pp;
│ Progress_unix.stopwatch ();
│ bar ~mode:`ASCII proportion;
│ using proportion (Units.percentage of_pp);
│ ]
│ |> box_winsize ~fallback:80 (* Dynamically scale to window size *)
│ |> periodic 100 (* Re-render once every 100 updates *)
│ |> accumulator Int64.add 0L (* Accumulate progress updates *))
│ |> make ~init:0L
└────
The `Segment' combinators are similar to those of general-purpose
pretty-printing libraries (e.g. [`pp'] and [`fmt']), but are equipped
with extra logic for "stateful" segments and segments that can have
dynamic width. Together, these make for a convenient way to express
common patterns when pretty-printing progress bars. For instance, the
stateful segment `periodic' seen above can be used to ensure that very
frequent updates from a hot-loop do not result in too much time spent
re-rendering the output.
The library is not yet feature-complete, but should still be
reasonably useful :slightly_smiling_face: Happy hacking!
[`Progress_unix.counter']
<https://craigfe.github.io/progress/progress/Progress_unix/index.html#val-counter>
[`Progress.Segment']
<https://craigfe.github.io/progress/progress/Progress/Segment/index.html>
[`pp'] <https://github.com/ocaml-dune/pp>
[`fmt'] <https://erratique.ch/software/fmt>
Brr 0.0.1, a toolkit for programming browsers
═════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-brr-0-0-1-a-toolkit-for-programming-browsers/6608/1>
Daniel Bünzli announced
───────────────────────
I'd like to announce the first release of Brr.
The TL; DR is:
If you are looking for a productive way to program
browsers with js_of_ocaml but without ppx and ghost OCaml
objects, give Brr a try.
The details:
Brr is a toolkit for programming browsers in OCaml with
the [`js_of_ocaml'] compiler. It provides:
• Interfaces to a [selection] of browser APIs.
• Note based reactive support (optional and experimental).
• An [OCaml console] developer tool for live interaction
with programs running in web pages.
• A JavaScript FFI for idiomatic OCaml programming.
Brr is distributed under the ISC license. It depends on
[Note] and on the `js_of_ocaml' compiler and runtime – but
not on its libraries or syntax extension.
• Homepage: <https://erratique.ch/software/brr>
• API Docs & manuals: <https://erratique.ch/software/brr/doc/> or
`odig doc brr'
• Install: `opam install brr'
Brr is essentially what I need to be productive for browser
programming with js_of_ocaml: an obvious FFI with JavaScript objects
as abstract data types without OCaml object phantom types and binding
documentation precisely linking into MDN.
The OCaml console is the hack on the cake. In the past I often found
it frustrating to have OCaml programs running in my webpages and be
greeted with a JavaScript prompt in the browser dev tools. Quite a
bit of polishing could be done on that though. Some of which should
likely directly be done upstream in the toplevel machinery
(e.g. identifier completion, a better toploop API and support for easy
pretty printer installation). It would also be nice if we could cut
down on `js_of_ocaml''s toplevel compilation times ;–)
Parts of Brr have been seriously dogfooded in the past but that new
incarnation is largely untested for now and certain APIs might need
adjustements. Early adopters should study actual binding coverage,
expect glitches and little breakages in the future.
The Note reactive functionality was also seriously used in the past
but Note itself needs a new design round and I don't have the
ressources to do it right now, expect breakage, don't pay too much
attention to it for now.
My thanks to the `js_of_ocaml' developers for the nice ocaml to
javascript compiler and a special shootout to Hugo Heuzard for not
getting mad at me when pinging him directly for questions.
Happy browser compatibility bug hunting,
[`js_of_ocaml'] <https://ocsigen.org/js_of_ocaml>
[selection]
<https://erratique.ch/software/brr/doc/index.html#supported_apis>
[OCaml console]
<https://erratique.ch/software/brr/doc/ocaml_console.html>
[Note] <https://erratique.ch/software/note>
gasche asked
────────────
It's not really released, but I'm curious about [Note] now: this is a
new FRP library from you, the author of [React] (the FRP library for
OCaml, not the Javascript framework of the same name).
Would you say a few words on why you went for a different library? My
guess would be that React depends on runtime mechanisms (weak
pointers) that are not well-supported in Javascript-lang; but even if
the guess is right, I'm not sure what would be the impact on the API
or properties of the library.
[Note] <https://erratique.ch/software/note>
[React] <https://erratique.ch/software/react>
Daniel Bünzli replied
─────────────────────
Would you say a few words on why you went for a different
library?
`Note' is the result from seeing people (and myself) struggling to use
~React~/FRP "correctly" over the years.
Some of this, I largely attribute to ergonomic problems with the
API. It's my hope for `Note' to address most of these points (one
thing that still needs to be done is replace fix points by a simple
lazy infinitesimal delay combinator).
I don't think I could have made all these changes in `React' itself so
I found it better to start a new library. Also I lost the trademark on
the name :–)
`Note' also tries to provide a much simpler implementation. `React''s
implementation was based on the [FrTime Phd thesis]. It's quite subtle
and involved and, as you suggested, uses weak pointer. `Note' tries to
avoid them since those are not available in the browser (but you have
things like [MutationObservers] which I use as gc in Brr's Note-based
[reactive dom support]).
However not using weak pointers has a semantic uncleanness cost whose
impact I'm unsure yet – without discipline from the programmer it may
lead to subtle and hard to track bugs when the reactive graph changes
dynamically, which I'm a bit wary of.
When my brain dumped `Note' I wrote a few more technical points in the
readme you can read them [here].
[FrTime Phd thesis] <http://cs.brown.edu/people/ghcooper/thesis.pdf>
[MutationObservers]
<https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver>
[reactive dom support]
<https://erratique.ch/software/brr/doc/Brr_note/Elr/index.html>
[here] <https://github.com/dbuenzli/note#history>
New release of Conduit
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-new-release-of-conduit/6611/1>
Calascibetta Romain announced
─────────────────────────────
*Conduit 3.0.0*
Hello everyone,
We're glad to announce the new release of [`conduit'], a framework
that allows to _abstract_ over transfer protocols. One of its main
advantages is allowing the implemententation of _free-dependencies_
protocols.
[`conduit'] <https://github.com/mirage/ocaml-conduit>
Introduction
╌╌╌╌╌╌╌╌╌╌╌╌
There are several ways to abstract over an implementation in
OCaml. However, those solutions are often lost deep in the stack of
protocols and allowing the user to choose the implementations of the
sub-procotols implies growing complexity as we move up through the
stack. (For example, allowing to abstract over the implementation of
the TLS protocol from the implementation of the HTTP protocol)
One of those solutions, the _functors_, can rapidly become a hellish
nightmare for the end-user. This is especially true in the case of
MirageOS, which literally wants to abstract over everything!
This is why Conduit was implemented: it aims to provide to the user a
cleaner abstraction mechanism which would allow the protocol
developers to get rid of most of the responsibilities concerning the
choice of sub-protocols (Like which TLS implementation use between
OpenSSL or our great [ocaml-tls] library), while giving the end-users
an easy way to compose the protocols of their choice and inject them
in the stack via conduit.
[ocaml-tls] <https://github.com/mirleft/ocaml-tls>
Usage of Conduit
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Such a framework allows us to separate the logic of a protocol from
underlying implementation needed to communicate with a peer. The
distribution of Conduit comes with [a simple tutorial] which explains
step by step how to implement a _ping-pong_ client & server and, most
importantly, how to upgrade them with TLS.
With Conduit, we ensure the compatibility with MirageOS (and specially
[mirage-tcpip]) while being useful for others. Of course, Conduit is
not mandatory to ensure this compatibility, but it helps us for
_higher_ libraries such as [ocaml-git]/[Irmin] or [Cohttp].
[a simple tutorial]
<https://mirage.github.io/ocaml-conduit/conduit/howto.html>
[mirage-tcpip] <https://github.com/mirage/mirage-tcpip>
[ocaml-git] <https://github.com/mirage/ocaml-git>
[Irmin] <https://github.com/mirage/irmin>
[Cohttp] <https://github.com/mirage/ocaml-cohttp>
Specific improvements
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
◊ Abstract and destruct it!
The most requested feature on the new version of Conduit is the
ability to _destruct_ the [Conduit.flow][conduit-flow]. The ability to
abstract the protocol comes with the _abstract_ type
`Conduit.flow'. The new version permits to _destruct_ it to a
well-known value (such as an UNIX socket):
┌────
│ let handler flow = match flow with
│ | Conduit_lwt.TCP.T (Value file_descr) ->
│ let peer = Lwt_unix.getpeername file_descr in
│ ...
│ | flow -> ... (* other kind of protocol *)
│
│ let run =
│ Cohttp_lwt_unix.serve ~handler
│ { sockaddr= Unix.inet_addr_loopback }
└────
◊ The dispatch of the protocol
The second most interesting feature of Conduit is the full control
over the dispatch between protocols by the end-user. From a concrete
information such as an `Uri.t', the end-user is able to describe how
Conduit should choose the protocol (and with which value it should try
to initiate the connection):
┌────
│ let my_tls_config = Tls.Config.client ...
│
│ let connect uri =
│ let edn = Conduit.Endpoint.of_string
│ (Uri.host_with_default ~default:"localhost" uri) in
│ let resolvers = match Uri.scheme uri with
│ | Some "https" ->
│ let port = Option.value ~default:443 (Uri.port uri) in
│ Conduit_lwt.add
│ Conduit_lwt_tls.TCP.protocol
│ (Conduit_lwt_tls.TCP.resolve ~port ~config:my_tls_config)
│ Conduit.empty
│ | Some "http" | None ->
│ let port = Option.value ~default:80 (Uri.port uri) in
│ Conduit_lwt.add
│ Conduit_lwt.TCP.protocol
│ (Conduit_lwt.TCP.resolve ~port)
│ Conduit.empty in
│ Conduit_lwt.resolve ~resolvers edn >>= fun flow ->
│ ...
└────
◊ An explicit way to launch a server
Conduit comes with a new API for the server-side, where everything
becomes explicit: no dispatch, no hidden choice. It proposes now a
simple function to start the usual server loop:
┌────
│ let run handler =
│ Conduit_lwt.serve ~handler
│ Conduit_lwt.TCP.service
│ { Conduit_lwt.TCP.sockaddr= Unix.(ADDR_INET (inet_addr_loopback, 8080)
│ ; capacity= 40 }
└────
Reverse-dependencies
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Conduit is used by many libraries (~150 packages) and we spend 2
months to track this breaking-change. Currently, it's mostly about
[Cohttp] and [Irmin] and both have a PR according the new version of
Conduit. These packages will be released as soon as we can with the
new version of Conduit.
[Cohttp] <https://github.com/mirage/ocaml-cohttp>
[Irmin] <https://github.com/mirage/irmin>
Conclusion
╌╌╌╌╌╌╌╌╌╌
Conduit is a piece required by many libraries but nobody really uses
it. This new version wants to replace and redefine more concretely
what Conduit is. The update is [huge] for us but small for people
where we tried to keep the same global idea of the abstraction.
I would like to thank many people (MirageOS core team, Cohttp peoples,
some not so famous guys of the Reason/OCaml eco-system) who followed
us on this deep development (and tried and iterated on our
version). It does not change too much our world, but it paves the way
for a better MirageOS/OCaml eco-system.
As a french guy, I just would like to say: Conduit est mort, Vive
Conduit!
[huge] <https://github.com/mirage/ocaml-conduit/pull/311>
Easy cross compilation using esy
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-easy-cross-compilation-using-esy/6612/1>
EduardoRFS announced
────────────────────
I've been working on this for a couple of months now, and now it is
ready for an initial announcement of my tools to cross compiling OCaml
and ReasonML Native.
<https://github.com/EduardoRFS/reason-mobile>
What it can do
╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Out of box it can cross compile most dune and topkg, packages
available on opam for a couple of platforms, there is also patches for
popular packages.
You can also compile opam packages by making an wrapper, like
<https://github.com/mirage/mirage-crypto/pull/84/files>
Limitations
╌╌╌╌╌╌╌╌╌╌╌
Your package should build with OCaml 4.10, and all the packages that
are built for the `host' will also be build for the `target', so
sometimes you need to fix a package that you will not use directly.
Some packages you will need to pin to a `dune-universe' fork version
How to use it
╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ ## compile your project
│ esy
│
│ ## generate the wrapper
│ esy add -D generate@EduardoRFS/reason-mobile:generate.json
│ esy generate android.arm64
│
│ ## build for android.arm64
│ esy @android.arm64
└────
Platforms
╌╌╌╌╌╌╌╌╌
All of the following are tested from Linux and macOS, but I would
suppose that FreeBSD should be also working as a build system.
━━━━━━━━━━━━━━━━━━━━━━
Targets
──────────────────────
android.arm64
android.x86_64
ios.arm64
ios.simulator.x86_64
linux.musl.arm64
linux.musl.x86_64
━━━━━━━━━━━━━━━━━━━━━━
What I tested
╌╌╌╌╌╌╌╌╌╌╌╌╌
In the past I was able to build `Revery' the UI framework for
`Android' and `iOS'
But recently I did compile `esy' the package manager itself for all of
the following platforms above from an `Arch Linux x86_64' and `macOS
Catalina x86_64'. Including `iOS', with the right version of OCaml it
will run inside of the new `macOS ARM64' and inside of a jailbroken
iPhone.
OCaml User Survey 2020
══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocaml-user-survey-2020/6624/1>
gasche announced
────────────────
We are happy to announce the [OCaml User Survey 2020]. We are trying
to get a better picture of the OCaml community and its needs. It would
be very useful if you could fill the survey (10-15 minutes), and share
it widely with other OCaml programmers!
The survey is run by the [OCaml Software Foundation]. Thanks in
particular to our sponsors OCamlPro (@MuSSF) for preparing many of the
questions, Jane Street (@Yaron_Minsky) for excellent feedback, and to
Kim @K_N Nguyễn for his technical help.
This is our first year running the survey, we hope to continue in
following years. There are many things to improve; please feel free to
give us feedback! (There is a feedback question at the end of the
survey, or you can post here, or send me a message/email.)
The survey was inspired by programming-language surveys ran by other
communities. See for example past survey results for [Go], [Haskell],
[Rust], and [Scala].
[OCaml User Survey 2020] <https://forms.gle/MAT7ZE7RtxTWuNgK7>
[OCaml Software Foundation] <https://ocaml-sf.org/>
[Go] <https://blog.golang.org/survey2019-results>
[Haskell] <https://taylor.fausak.me/2019/11/16/haskell-survey-results/>
[Rust] <https://blog.rust-lang.org/2020/04/17/Rust-survey-2019.html>
[Scala] <https://scalacenter.github.io/scala-developer-survey-2019/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 41767 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-10-06 7:22 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-10-06 7:22 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 4523 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of September 29 to
October 06, 2020.
Table of Contents
─────────────────
vue-jsoo 0.2
Rehabilitating packs using functors and recursivity, part 2
Clap 0.1.0 (Command-Line Argument Parsing)
Old CWN
vue-jsoo 0.2
════════════
Archive: <https://discuss.ocaml.org/t/ann-vue-jsoo-0-2/6522/1>
levillain.maxime announced
──────────────────────────
I'd like to announce the second release of vue-jsoo (vue-jsoo.0.2). A
js_of_ocaml binding and helpers to use the vue-js framework with
js_of_ocaml.
Xavier Van de Woestyne added
────────────────────────────
Here is the link: <https://gitlab.com/o-labs/vue-jsoo>
(Congratulation!)
Rehabilitating packs using functors and recursivity, part 2
═══════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/rehabilitating-packs-using-functors-and-recursivity-part-2/6525/1>
OCamlPro announced
──────────────────
Following the publication of [the first part] of our blogpost about
the redemption of packs in the OCaml ecosystem, we are pleased to
share "[Rehabilitating packs using functors and recursivity, part 2.]"
This blog post and the previous one about functor packs
covers two RFCs currently developed by OCamlPro and Jane
Street. We previously introduced functor packs, a new
feature adding the possiblity to compile packs as
functors, allowing the user to implement functors as
multiple source files or even parameterized libraries.
In this blog post, we will cover the other aspect of the
packs rehabilitation: allowing anyone to implement
recursive compilation units using packs (as described
formally in the RFC#20). Our previous post introduced
briefly how packs were compiled and why we needed some
bits of closure conversion to effectively implement big
functors. Once again, to implement recursive packs we will
need to encode modules through this technique, as such we
advise the reader to check at least the introduction and
the compilation part of functor packs.
[the first part]
<https://www.ocamlpro.com/2020/09/24/rehabilitating-packs-using-functors-and-recursivity-part-1/>
[Rehabilitating packs using functors and recursivity, part 2.]
<https://www.ocamlpro.com/2020/09/30/rehabilitating-packs-using-functors-and-recursivity-part-2/>
Clap 0.1.0 (Command-Line Argument Parsing)
══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-clap-0-1-0-command-line-argument-parsing/6544/1>
rbardou announced
─────────────────
I am happy to announce the first release of Clap.
Clap is a library for command-line argument parsing. Clap works by
directly consuming arguments in an imperative way. Traditionally,
argument parsing in OCaml is done by first defining a specification
(an OCaml value defining the types of arguments), and then parsing
from this specification. The "impure" approach of Clap skips the need
to define a specification and results in code which is quite simple in
practice, with limited boilerplate.
Clap is available as an opam package (`opam install clap').
Source code, API documentation and a full commented example are
available at: <https://github.com/rbardou/clap/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 15116 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-09-29 7:02 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-09-29 7:02 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 14486 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of September 22 to
29, 2020.
Table of Contents
─────────────────
Opam-repository: security and data integrity posture
jsonoo 0.1.0
Interesting OCaml Articles
Rehabilitating Packs using Functors and Recursivity
the OCaml Software Foundation
dual 0.1.0
Old CWN
Opam-repository: security and data integrity posture
════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/opam-repository-security-and-data-integrity-posture/6478/1>
Chas Emerick said, spawning a huge thread
─────────────────────────────────────────
In connection with [another thread] discussing the fact that
Bitbucket's closure of mercurial support had affected the availability
of around 60+ projects' published versions, I learned of a number of
facts about how the opam repository is arranged, and how it is managed
that are concerning.
In summary, it seems that opam / opam-repository:
1. Never retains "published" artifacts, only links to them as provided
by library authors.
2. Allows very weak hashes (even md5).
3. Allows authors to _update_ artifact URLs and hashes of previously
"published" versions.
4. Offers scant support for individually signing artifacts or
metadata.
All of these are quite dangerous. As a point of reference, the
ecosystems I am most familiar with using prior to OCaml (JVM and
Javascript) each had very serious documented failures and exploits
(and many many more quiet ones) until their respective package
managers (Maven Central et al., and npm) plugged the above
vulnerabilities that opam-repository suffers from.
To make things concrete, without plugging the above (and especially
items 1-3):
• the availability and integrity of published libraries can be
impacted by third-party hosting services changing or going offline
(as in the case of the Bitbucket closure)
• the integrity of libraries can be impacted by authors
non-maliciously publishing updates to already-released versions,
affecting functionality, platform compatibility, build
reproducibility, or all of the above (anecdotes of which were shared
with me when talking about this issue earlier today)
• the integrity of libraries can be impacted by malicious authors
publishing updates to already-released versions
• the integrity of libraries can be impacted by malicious non-authors
changing the contents at tarball URLs to include changed code that
could e.g. exfiltrate sensitive data from within the organizations
that use those libraries. This is definitely the nuclear nightmare
scenario, and unfortunately opam is wide open to it thanks to
artifacts not being retained authoritatively and [essential
community libraries] continuing to use md5 in 2020.
Seeing that this has been well-established policy for years was
honestly quite shocking (again, in comparison to other languages'
package managers that have had these problems licked for a very very
long time). I understand that opam and its repository probably have
human-decades of work put into them, and that these topics have been
discussed here and there (in somewhat piecemeal fashion AFAICT), so
I'm certain I have not found (nevermind read) all of the prior art,
but I thought it reasonable to open a thread to gauge what the
projects' posture is in general.
[another thread]
<https://discuss.ocaml.org/t/bitbucket-stopped-supporting-mercurial-repositories/6324/3?u=cemerick>
[essential community libraries]
<https://github.com/ocaml/opam-repository/blob/master/packages/core/core.v0.14.0/opam>
Hannes Mehnert replied
──────────────────────
first of all thanks for your post raising this issue, which is
important for me as well.
I've been evaluating and working on improving the security of the
opam-repository over the years, including to not use `curl –insecure`
(i.e. properly validate TLS certificates) - the WIP result is [conex],
which aims at cryptographically signed community repositories without
single points of failures (threshold signatures for delegations,
built-in key rollover, …) - feel free to read the blog posts or OCaml
meeting presentations. Unfortunately it still has not enough traction
to be deployed and mandatory for the main opam repository. Without
cryptopgraphic signatures (and an established public key
infrastructure), the hashes used in opam-repository and opam are more
checksums (i.e. integrity protection) than for security. Threat models
- I recommend to read section [1.5.2 "goals to protect against
specific attacks"] - that's what conex above is based on and attempts
to mitigate. I'll most likely spend some time on improving conex over
the next year, and finally deploying it on non-toy repositories.
In the meantime, what you're mentioning:
1. "Never retains 'published' artifacts" <- this is not true, the
opam.ocaml.org host serves as an artifact cache, and is used by
opam when you use the default repository. This also means that the
checksums and the tarballs are usually taken from the same host ->
the one who has access there may change anything arbitrarily for
all opam users.
2. "Weak hashes" <- this is true, I'd appreciate if (a) opam would
warn (configurable to error out) if a package which uses weak
checksum algorithms, and (b) Camelus or some other CI step would
warn when md5/sha1 are used
3. "Authors can modify URLs and hashes" <- sometimes (when a
repository is renamed or moved on GitHub) the GitHub auto-generated
tarball has a different checksum. I'd appreciate to, instead of
updating that meta-data in the opam-repository to add new
patch-versions (1.2.3-1 etc.) with the new URL & hash - there could
as well be a CI job / Camelus check what is allowed to be modified
in an edit of a package (I think with the current state of the
opam-repository, "adding upper bounds" on dependencies needs to be
allowed, but not really anything else).
4. I'm not sure I understand what you mean - is it about cryptographic
signatures and setting up a public key infrastructure?
[conex] <https://github.com/hannesm/conex>
[1.5.2 "goals to protect against specific attacks"]
<https://github.com/theupdateframework/specification/blob/master/tuf-spec.md#the-update-framework-specification>
Anton Kochkov said
──────────────────
Closely related issue is
<https://discuss.ocaml.org/t/how-to-setup-local-opam-mirror/4423>,
since the integrity checks and verification will become even more
important if there will be multiple mirrors in the future.
jsonoo 0.1.0
════════════
Archive: <https://discuss.ocaml.org/t/ann-jsonoo-0-1-0/6480/1>
Max LANTAS announced
────────────────────
Hello! I am announcing the first release of `jsonoo', a JSON library
for Js_of_ocaml.
<https://github.com/mnxn/jsonoo>
<https://opam.ocaml.org/packages/jsonoo>
This library provides a very similar API to the excellent BuckleScript
library, [bs-json] by [glennsl]. Unlike bs-json, this port of the
library tries to follow OCaml naming conventions and be easier to
interface with other OCaml types like `Hashtbl.t' . This library
passes a nearly equivalent test suite.
This project is part of ongoing work to port [vscode-ocaml-platform]
to Js_of_ocaml.
Generated documentation can be found [here].
[bs-json] <https://github.com/glennsl/bs-json>
[glennsl] <https://github.com/glennsl>
[vscode-ocaml-platform]
<https://github.com/ocamllabs/vscode-ocaml-platform>
[here] <https://mnxn.github.io/jsonoo/jsonoo/Jsonoo/index.html>
Interesting OCaml Articles
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/interesting-ocaml-articles/1867/62>
Ryan Slade announced
────────────────────
<https://blog.darklang.com/fizzboom-benchmark/>
Rehabilitating Packs using Functors and Recursivity
═══════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/rehabilitating-packs-using-functors-and-recursivity/6497/1>
OCamlPro announced
──────────────────
Our new blogpost is about the redemption of packs in the OCaml
ecosystem. This first part shows our work to generate functor units
and functor packs : [Rehabilitating Packs using Functors and
Recursivity, part 1.]
Packs in the OCaml ecosystem are kind of an outdated
concept (options `-pack' and `-for-pack' the OCaml manual,
and their main utility has been overtaken by the
introduction of module aliases in OCaml 4.02. What if we
tried to redeem them and give them a new youth and utility
by adding the possibility to generate functors or
recursive packs?
This blog post covers the functor units and functor packs,
while the next one will be centered around recursive
packs. Both RFCs are currently developed by JaneStreet and
OCamlPro. This idea was initially introduced by functor
packs (Fabrice Le Fessant) and later generalized by
functorized namespaces (Pierrick Couderc /et al/.).
[Rehabilitating Packs using Functors and Recursivity, part 1.]
<https://www.ocamlpro.com/2020/09/24/rehabilitating-packs-using-functors-and-recursivity-part-1/>
the OCaml Software Foundation
═════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-the-ocaml-software-foundation/4476/19>
gasche announced
────────────────
We were all very busy during the last semester, and have been mostly
quiet on the foundation activities, but of course our actions were
running in the background. Some highlights:
• Kate @kit-ty-kate Deplaix has worked on opam-repository QA for the
OCaml 4.11 release, and the work and results are just as superb as
for 4.10. We will fund Kate to work again on the upcoming 4.12
release.
• We are funding ongoing maintenance work on [ocaml-rs] (a port of the
OCaml FFI library from C to Rust) by its author and maintainer, Zach
@zshipko Shipko. Zach did a big round of cleanup changes this
summer, improving the overall design of the library and completing
its feature set.
• We are funding @JohnWhitington (the author of [OCaml from the Very
Beginning]) to do some technical writing work for OCaml
documentation. His contributions so far have been very diverse, from
a script to harmonize the documentation of List and ListLabels (and
Array and ArrayLabels, etc.) in the standard library, to small
cleanups and improvement to ocaml.org web pages. One focus of his
work is the upcoming documentation page "Up and running with OCaml",
taking complete newcomers through the basic setup, using the
toplevel and building and running a Hello World. ([ocaml.org#1165],
[rendered current state])
• Two [Outreachy] internships were supervised this summer, focusing on
the compiler codebase. Florian @Octachron Angeletti (INRIA)
supervised an intern on adding a JSON format for some compiler
messages (we expect PRs to be submitted soon). Vincent @vlaviron
Laviron and Guillaume @zozozo Bury (OCamlPro) supervised an intern
on reducing mutable state in the internal implementation.
• Inspired by [this Discuss thread], we are funding experimental work
by @sanette on the HTML rendering of the OCaml manual. This work is
in the process of being reviewed for upstreaming in the OCaml
compiler distribution. ([#9755].) This is a better end-result than I
had initially expected.
(We also had a couple non-highlights. For example, we funded a sprint
(physical development meeting) for the [Owl] contributors, with
Marcello @mseri Seri doing all the organization work; it was planned
for the end of March, and had to be postponed due to the pandemic.)
[ocaml-rs] <https://github.com/zshipko/ocaml-rs/>
[OCaml from the Very Beginning] <http://ocaml-book.com/>
[ocaml.org#1165] <https://github.com/ocaml/ocaml.org/pull/1165>
[rendered current state]
<https://github.com/johnwhitington/ocaml.org/blob/up-and-running/site/learn/tutorials/up_and_running.md>
[Outreachy] <https://outreachy.org>
[this Discuss thread]
<https://discuss.ocaml.org/t/suggestions-for-ocaml-documentation/4504>
[#9755] <https://github.com/ocaml/ocaml/pull/9755>
[Owl] <https://github.com/owlbarn>
dual 0.1.0
══════════
Archive: <https://discuss.ocaml.org/t/ann-dual-0-1-0/6512/1>
Jason Nielsen announced
───────────────────────
I’ve released [dual] which is now up on opam. It is a dual numbers
library which includes a one dimensional root finder (via Newton's
method).
[dual] <https://github.com/drjdn/ocaml_dual>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 26248 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-09-22 7:27 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-09-22 7:27 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 15579 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of September 15 to
22, 2020.
Table of Contents
─────────────────
Liquidsoap 1.4.3
Simple63 v1: compression of integer sequences
bentov v1: streaming estimation of 1D histograms
opam-compiler 0.1.0
lua_parser 1.0.0
Merlin 3.4.0 : introducing external configuration readers
gRPC server and client in OCaml
Bitstring (and ppx_bitstring) 4.0.0
Old CWN
Liquidsoap 1.4.3
════════════════
Archive: <https://discuss.ocaml.org/t/ann-liquidsoap-1-4-3/6429/1>
Romain Beauxis announced
────────────────────────
I'm happy to announce that liquidsoap `1.4.3' is out at:
<https://github.com/savonet/liquidsoap/releases/tag/v1.4.3>
This is the 3rd bugfix release for the `1.4.x' branch. It contains
important fixes and a couple of new minor features. Update is
recommended and should be fairly safe.
Along we this release, we have now added builds for `arm64' debian
packages and docker-ready production images for `amd64' and `arm64'
architectures available at:
<https://hub.docker.com/repository/docker/savonet/liquidsoap>
Again, we would like to warmly thank all users, contributors and
reporters for helping us bring liquidsoap to the next step!
Also, please note that a couple of issues had to be left out to make
sure that the release comes out on time. These are listed [here] and
will be tackled as soon as possible.
Next for liquidsoap, we will focus on getting the current `2.x' branch
finalized and polished. We already have support for encoded content
and ffmpeg raw frames. We need to write a couple of inline encoders
and decoders and we'll have 90% of the features ready. This will be a
major update for us!
[here] <https://github.com/savonet/liquidsoap/milestone/7>
Simple63 v1: compression of integer sequences
═════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-simple63-v1-compression-of-integer-sequences/6431/1>
Mika Illouz announced
─────────────────────
This is to announce Simple63, an opam package for compression of
integer sequences; similar to Anh and Moffat's Simple-8b. More details
found in:
• github: [https://github.com/barko/simple63]
• documentation: [https://barko.github.io/simple63/]
Feedback and bug reports welcome.
[https://github.com/barko/simple63] <https://github.com/barko/simple63>
[https://barko.github.io/simple63/] <https://barko.github.io/simple63/>
bentov v1: streaming estimation of 1D histograms
════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-bentov-v1-streaming-estimation-of-1d-histograms/6434/1>
Mika Illouz announced
─────────────────────
This is to announce bentov, a opam package that implements a 1D
histogram-sketching algorithm. For more details:
• github: [https://github.com/barko/bentov]
• documentation: [https://barko.github.io/bentov]
Feedback and bug reports welcome.
[https://github.com/barko/bentov] <https://github.com/barko/bentov>
[https://barko.github.io/bentov] <https://barko.github.io/bentov>
opam-compiler 0.1.0
═══════════════════
Archive: <https://discuss.ocaml.org/t/ann-opam-compiler-0-1-0/6442/1>
Etienne Millon announced
────────────────────────
On behalf of the opam maintainers, I'd like to announce the first
release of opam-compiler, a plugin to work with compiler variants,
branches and forks.
This can cover a pretty wide range of use cases, so the first version
is starting small with a single command to create a switch from a
branch or github PR:
┌────
│ % opam compiler create '#9921'
│ Opam plugin "compiler" is not installed. Install it on the current switch? [Y/n] y
│
│ ...
│
│ <><> Carrying on to "opam compiler create #9921" ><><><><><><><><><><><><><><><>
│
│ [ocaml-variants.4.12.0+trunk+no-flat-float-array] synchronised from
│ git+https://github.com/gasche/ocaml#Atomic.create
│ ocaml-variants is now pinned to git+https://github.com/gasche/ocaml#Atomic.create (version
│ 4.12.0+trunk)
│ % opam switch
│ ...
│ → ocaml-ocaml-9921
│ [opam-compiler] ocaml/ocaml#9921 - stdlib: rename Atomic.make into Atomic.create
└────
You can also override the arguments passed to `--configure'.
As you can see in the above snippet, it's an opam plugin so it will
auto-install if needed (assuming you ran `opam update' recently) and
will be available across all switches. Its sources and issue tracker
are available [here].
For the next releases, our plan is to add a user-friendly way to setup
a switch based on a local git clone, so that it's easy to test your
compiler fork with opam packages. You can find the other features we'd
like to add in the future in [the relevant part of the opam roadmap].
Thanks and have fun compiling compilers!
[here] <https://github.com/ocaml-opam/opam-compiler>
[the relevant part of the opam roadmap]
<https://github.com/ocaml/opam/wiki/Spec-for-working-with-the-OCaml-compiler>
lua_parser 1.0.0
════════════════
Archive: <https://discuss.ocaml.org/t/ann-lua-parser-1-0-0/6445/1>
Jason Nielsen announced
───────────────────────
I've release [lua_parser] which is now up on opam. It is a parser and
pretty-printer for lua 5.2. Actually it was developed with luajit in
mind which is lua 5.1 plus goto/labels (which syntactically for the
purposes of parsing and pretty-printing is lua 5.2).
[lua_parser] <https://github.com/drjdn/ocaml_lua_parser>
Merlin 3.4.0 : introducing external configuration readers
═════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-merlin-3-4-0-introducing-external-configuration-readers/6446/1>
vds announced
─────────────
I am glad to announce, on behalf of the Merlin team, the release of
Merlin `3.4.0' which brings some major changes in the way
configuration is handled.
As you might know, Merlin reads its configuration from the closest
`.merlin' file to the source file being edited. These files tell
merlin where to find other source files and build artifacts, but also
which flags should be passed to the compiler, which syntax extensions
are enabled and which packages are used by the project.
In this setting the configuration is the same for all the source files
of a folder, regardless of their specificities. In other words, the
configuration loaded for a single source file contains the union of
the dependencies of this file and of all its siblings which is not an
optimal behavior.
Starting with version `3.4.0' merlin will ship with two packages:
`merlin' and `dot-merlin-reader' which, as the name suggests, reads
configuration from `.merlin' files. Both are necessary for proper
function.
When a `.merlin' file is present in the source folder the Merlin
server will start a `dot-merlin-reader' process and communicate with
it via standard input and output following a simple protocol. These
processes are halted with the server.
*This change should not have any visible impact on users' workflows as
long as the `dot-merlin-reader' binary is correctly installed and in
the path*. (which should be the case in opam-based setups)
This change in itself will not solve the granularity problem mentioned
earlier, but it paves the way for such improvements: in a near-future
Dune will stop generating `.merlin' files and Merlin will obtain
file-based configuration directly from the build system using the same
protocol as the one used by `dot-merlin-reader'.
Changelog
╌╌╌╌╌╌╌╌╌
⁃ merlin binary
• fix completion of pattern matchings with exception patterns
(#1169)
• delegate configuration reading to external programs via a simple
protocol and create a new package `dot-merlin-reader' with a
binary that reads `.merlin' files. (#1123, #1152)
gRPC server and client in OCaml
═══════════════════════════════
Archive:
<https://discuss.ocaml.org/t/grpc-server-and-client-in-ocaml/6465/1>
blandinw announced
──────────────────
TL;DR <https://github.com/blandinw/ocaml-grpc-envoy/>
Hey, I'm new to OCaml after writing some Clojure, C++ and Haskell in
various contexts, including working at FB (relevant below).
After browsing this forum and Reddit for a bit, the assumption seems
to be that OCaml is not a good fit for gRPC, since there's no pure
implementation today. Now, this is something I have experience with,
so I thought I'd try and challenge this assumption.
As you may know, services inside FB use Thrift (both the format and
protocol) to communicate. The Thrift team worked primarily in C++ (for
good reasons), causing support for other languages to lag behind
despite their best efforts. Now, the interchange format (equivalent to
Protobuf) does not change very often so it's fine to have a
per-language implementation, but the client and server (equivalent to
HTTP2 + gRPC) frequently receive new features, optimizations and
fixes. After a valiant and continued effort to support most languages
used internally, the Thrift team came up with an idea. Instead of
maintaining multiple implementations and dealing with obscure FFI
bugs, ~FingerprintTrustManagerFactory~s and whatnot, they would focus
solely on the C++ implementation and provide a daemon to be ran
alongside whatever code you were trying to run. You could then use
simple IPC to exchange Thrift (the format) messages with that daemon,
and it would handle all the nitty-gritty of running a service at scale
(load balancing, connection pooling, service discovery, security,
retries, timeouts, network stats, hot restarts, etc.). Needless to
say, it worked remarkably well even at very high scale and everybody
was much happier.
I wanted to replicate this idea with OCaml and gRPC. We already have
support for protobuf thanks to the excellent `ocaml-protoc'. All we
need is a way to exchange protobuf messages reliably on the wire.
Instead of having an OCaml implementation that will have to stay
up-to-date and have its own set of bugs (the official `grpc/grpc-java'
repo has 4450 commits and 2400 issues at the moment), can we reuse
existing infra with already massive support and production time?
Fortunately, the people at Lyft built just that, open-sourced it and
contributed it to the Cloud Native Computing Foundation in late
2017. It is called Envoy and it is bliss.
I demonstrate how to fit these pieces together at
[blandinw/ocaml-grpc-envoy] to build a simple KV store, including a
gRPC client and server in 200 lines of OCaml code. The idea is to
spawn an Envoy process that will handle all gRPC communication for our
OCaml code. We use HTTP/1.1 to exchange Protobuf messages with it,
using for example `httpaf' and `Lwt'. This solution has the added
benefit that it is highly scalable from the start, allowing you for
instance to spawn one OCaml process per core and load balance between
them. You can also use Envoy (with proper config!) as your web reverse
proxy instead of say, nginx.
At the very least, this solution allows us to start writing gRPC code
today, and gracefully evolve towards HTTP/2, Multicore and maybe a
native OCaml implementation later.
I'm curious to hear your perspective on the future of building
services with OCaml, or your past experience like what went well, what
was missing, etc.
[blandinw/ocaml-grpc-envoy]
<https://github.com/blandinw/ocaml-grpc-envoy/>
Yawar Amin asked and blandinw replied
─────────────────────────────────────
Fantastic idea. So if I understand correctly, the only
thing that Envoy (server-side) is doing is translating the
Protobuf from gRPC HTTP2 transport to HTTP1, and
forwarding these Protobuf objects over HTTP1 to the OCaml
server? Envoy doesn't know to know about the actual gRPC
schema, because it doesn't touch the Protobuf objects
themselves, right?
That's correct. Envoy is only concerned with transporting bytes (along
with load balancing, routing, etc, etc). Only OCaml knows about the
Protobuf schemas.
In the OCaml server case, Envoy listens for HTTP/2 gRPC requests,
accesses the bytes payload with no knowledge of the actual
schema/layout and repackages these same bytes in a HTTP/1.1 request
that OCaml can process. OCaml then responds with bytes (an encoded
Protobuf response message) that Envoy sends back on the original HTTP2
connection.
Bitstring (and ppx_bitstring) 4.0.0
═══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-bitstring-and-ppx-bitstring-4-0-0/6471/1>
xrguerin announced
──────────────────
Features
╌╌╌╌╌╌╌╌
• Add support for let bindings introduced in 4.08
• Switch to PPXLIB
Deprecations
╌╌╌╌╌╌╌╌╌╌╌╌
As PPXLIB requires `ocaml >= 4.04' support for earlier versions has
been dropped.
Breaking changes
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
This release splits the library from the PPX to reduce runtime
dependencies. Projects using the PPX from bitstring will need to also
depends on ppx_bitstring from now on.
Rudi Grinberg added
───────────────────
The project is hosted [here] for those who are interested.There's also
some excellent [docs]
[here] <https://github.com/xguerin/bitstring>
[docs] <https://bitstring.software/documentation/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 28846 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-09-08 13:11 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-09-08 13:11 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 29657 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of September 01 to
08, 2020.
Table of Contents
─────────────────
OCaml 4.11.1: early bugfix release
textmate-language 0.1.0
Batteries v3.1.0
Job offer in Paris - Be Sport
Some SIMD in your OCaml
A PPX Rewriter approach to ocaml-migrate-parsetree
telltime - when is when exactly?
Ocamlunit emacs minor-mode
Sihl 0.1.0
promise_jsoo 0.1.0
Other OCaml News
Old CWN
OCaml 4.11.1: early bugfix release
══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-4-11-1-early-bugfix-release/6337/1>
octachron announced
───────────────────
A serious bug has been discovered last week in OCaml 4.11.0: explicit
polymorphic annotations are checked too permissively. Some incorrect
programs (possibly segfaulting) are accepted by the compiler in
4.11.0.
Programs accepted by OCaml 4.10 are unchanged.
We are thus releasing OCaml 4.11.1 as an early bugfix version. You
are advised to upgrade to this new version if you were using OCaml
4.11.0.
It is (or soon will be) available as a set of OPAM switches with
┌────
│ opam switch create 4.11.1
└────
and as a source download here:
<https://caml.inria.fr/pub/distrib/ocaml-4.11/>
This bug was introduced when making polymorphic recursion easier to
use. We are working on making the typechecker more robust and more
exhaustively tested to avoid such issues in the future.
Bug fixes:
╌╌╌╌╌╌╌╌╌╌
• [#9856], [#9857]: Prevent polymorphic type annotations from
generalizing weak polymorphic variables. (Leo White, report by
Thierry Martinez, review by Jacques Garrigue)
• [#9859], [#9862]: Remove an erroneous assertion when inferred
function types appear in the right hand side of an explicit :>
coercion (Florian Angeletti, report by Jerry James, review by Thomas
Refis)
[#9856] <https://github.com/ocaml/ocaml/issues/9856>
[#9857] <https://github.com/ocaml/ocaml/issues/9857>
[#9859] <https://github.com/ocaml/ocaml/issues/9859>
[#9862] <https://github.com/ocaml/ocaml/issues/9862>
Rwmjones then said
──────────────────
We've now got 4.11.1 in Fedora 33 & Fedora 34. No apparent problems
so far.
textmate-language 0.1.0
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-textmate-language-0-1-0/6339/1>
dosaylazy announced
───────────────────
I am pleased to announce [textmate-language 0.1.0]. Textmate-language
is a library for tokenizing code using TextMate grammars. Therefore,
it may be useful for implementing syntax highlighters. Please report
any bugs or API inconveniences you find.
[textmate-language 0.1.0]
<https://opam.ocaml.org/packages/textmate-language/textmate-language.0.1.0/>
Batteries v3.1.0
════════════════
Archive: <https://discuss.ocaml.org/t/batteries-v3-1-0/6347/1>
UnixJunkie announced
────────────────────
OCaml Batteries Included is a community-maintained extended standard
library for OCaml.
The latest API can be found here:
<https://ocaml-batteries-team.github.io/batteries-included/hdoc2/>
This minor release adds support for OCaml 4.11. It has been available
in opam for some days.
Special thanks to all the contributors!
The changelog follows:
• Compatibility fixes for OCaml-4.11 [#962] (Jerome Vouillon)
• BatEnum: added combination [#518] (Chimrod, review by hcarty)
• fix benchmarks [#956] (Cedric Cellier)
• BatFile: added count_lines [#953] (Francois Berenger, review by
Cedric Cellier)
• BatArray: use unsafe_get and unsafe_set more often [#947] (Francois
Berenger, review by Cedric Cellier)
• fix some tests for ocaml-4.10.0 [#944] (kit-ty-kate)
• BatResult: BatPervasives.result is now equal to Stdlib.result
instead of sharing constructors without being the same type [#939],
[#957] (Clément Busschaert, Cedric Cellier).
[#962]
<https://github.com/ocaml-batteries-team/batteries-included/pull/962>
[#518]
<https://github.com/ocaml-batteries-team/batteries-included/pull/518>
[#956]
<https://github.com/ocaml-batteries-team/batteries-included/pull/956>
[#953]
<https://github.com/ocaml-batteries-team/batteries-included/pull/953>
[#947]
<https://github.com/ocaml-batteries-team/batteries-included/pull/947>
[#944]
<https://github.com/ocaml-batteries-team/batteries-included/pull/944>
[#939]
<https://github.com/ocaml-batteries-team/batteries-included/pull/939>
[#957]
<https://github.com/ocaml-batteries-team/batteries-included/pull/957>
Job offer in Paris - Be Sport
═════════════════════════════
Archive:
<https://discuss.ocaml.org/t/job-offer-in-paris-be-sport/6355/1>
Vincent Balat announced
───────────────────────
Be Sport is looking to hire an OCaml developer with skills in
• Mobile/web feature design
• Team management
• Use of Social networks
She/he will take part in the development of our Web and mobile apps,
entirely written in OCaml with Ocsigen, and participate in reflections
on features.
Please contact me for more information or send an email to
jobs@besport.com.
Some SIMD in your OCaml
═══════════════════════
Archive: <https://discuss.ocaml.org/t/some-simd-in-your-ocaml/6367/1>
Anmol Sahoo announced
─────────────────────
Fresh from a weekend of hacking, I would like to share some results of
an experiment I conducted of creating a library for exposing Intel
AVX2 intrinsics to OCaml code. AVX2 is an instruction set subset that
adds data-parallel operations in hardware.
I chose to fork the amazing [bigstringaf] library and modified it. You
can find the additions to the code here - [bigstringaf_simd].
[bigstringaf] <https://github.com/inhabitedtype/bigstringaf>
[bigstringaf_simd]
<https://github.com/anmolsahoo25/bigstringaf/blob/8df94c4fb5607317ee9634611784eea65368a270/lib/bigstringaf_simd.mli#L287>
Overview
╌╌╌╌╌╌╌╌
Given a type `Bigstring.t' (1 dimensional byte arrays) there now exist
functions such as -
┌────
│ val cmpeq_i8 : (t * int) -> (t * int) -> (t * int) -> unit
└────
So `cmpeq_i8 (x,o1) (y,o2) (z,03)' will compare 32 bytes starting at
`o1' and `o2' from `x' and `y' respectively and store the result in
`z' at `o3'.
Why?
╌╌╌╌
This was mainly an exercise in curiosity. I just wanted to learn
whether something like this is viable. I also want to see if adding
some type-directed magic + ppx spells can let us write data parallel
code much more naturally similar to what `lwt / async' did for async
code.
At the same time, you might ask - why not use something like Owl
(which already has good support for data-parallel operations)? Apart
from the fact that such libraries are oriented towards numerical code,
I would also like to explore if we can operate directly on OCaml types
and cast them into data parallel algorithms. Like how `simdjson'
pushed the boundaries of JSON parsing, it would be nice to port
idiomatic code to data-parallel versions in OCaml. Can we, at some
point, have generic traversals of data-types, which are actually
carried out in a data-parallel fashion?
Does it work?
╌╌╌╌╌╌╌╌╌╌╌╌╌
Given the limitation of the current implementation (due to foreign
function calls into C), I still found some preliminary results to be
interesting! Implementing the `String.index' function, which returns
the first occurence of a char, the runtime for finding an element at
the `n-1' position in an array with `320000000' elements is -
┌────
│ serial: 1.12 seconds
│ simd: 0.72 seconds (1.5x)
└────
I still have to do the analysis what the overhead of the function call
into C is (even with `[@@noalloc]'!
Future directions
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
It would be interesting to see, if we can create a representation
which encapsulates the various SIMD ISA's such as AVX2, AVX512, NEON,
SVE etc. Further more, it would be really interesting to see if we can
use ppx to automatically widen `map` functions to operate on blocks of
code, or automatically cast data types in a data parallel
representation.
Disclaimer
╌╌╌╌╌╌╌╌╌╌
This was mostly a hobby project, so I cannot promise completing any
milestones or taking feature requests etc. I definitely do not
recommend using this in production, because of the lack of testing
etc.
A PPX Rewriter approach to ocaml-migrate-parsetree
══════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/a-ppx-rewriter-approach-to-ocaml-migrate-parsetree/6369/1>
Chet Murthy announced
─────────────────────
TL;DR
╌╌╌╌╌
Based on `camlp5' and the `pa_ppx' PPX rewriters, I've written a new
one, `pa_deriving_plugins.rewrite', that automates almost all the work
of writing a migration from one version of OCaml's AST to another.
1. It took a few days (b/c of laziness) to write the initial PPX
rewriter
2. A day to get 4.02->4.03 AST migration working
3. a couple of hours to get 4.03->4.02 working
4. and a few more hours to get 4.03<->4.04 and 4.04<->4.05 working
At this point, I fully expect that the other version-pairs will not be
difficult.
You can find this code [warning: very much a work-in-progress] at
<https://github.com/chetmurthy/pa_ppx/tree/migrate-parsetree-hacking>
The file `pa_deriving.plugins/pa_deriving_rewrite.ml' contains the
source for the PPX rewriter.
The directory `pa_omp' contains the migrations, typically named
`rewrite_NNN_MMM.ml'.
A slightly longer-winded explanation
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
If you think about it, `ppx_deriving.map' isn't so different from what
we need for `ocaml-migrate-parsetree'. `ppx_deriving.map', from a
type definition for ~ 'a t~, will automatically generate a function
┌────
│ map_t : ('a -> 'b) -> 'a t -> 'b t
└────
If you think about it, if we could just substitute our own type for
the second occurrence of `t' (somehow …. yeah *grin*) then it would be
almost like what we want for o-m-p, yes?
With 11 versions of the Ocaml AST so far, maybe it's worth thinking
about how to automate more of the migration task. Also, since so much
of it is type-structure-driven, one would think that it would be an
excellent opportunity to apply PPX rewriting technology. *Indeed, one
might think that a good test of PPX rewriting, is the ability to
automate precisely such tasks.*
So what's hard about this migration task? Here are some issues (maybe
there are more):
1. the types are slightly differently-organized in different versions
of the AST. Types might move from one module to another.
2. sometimes new types are introduced and old ones disappear
3. constructor data-types may get new branches, or lose them
4. record-types may get new fields, or lose them
5. sometimes the analogous types in two consecutive versions are just
really, really different [but this is rare]: we need to supply the
code directly
6. when mapping from one version to another, sometimes features are
simply not mappable, and an error needs to be raised; that error
ought to contain an indication of where in the source that
offending feature was found
7. And finally, when all else fails, we might need to hack on the
migration code directly
But morally, the task is really straightforward (with problems listed
in-line):
1. use `ppx_import' to copy over types from each of the AST times of
each Ocaml version
• `ppx_import' works on `.cmi' files, and those have different
formats in different versions of Ocaml. Wouldn't it be nice if
it worked on `.mli' files, whose syntax (b/c OCaml is
well-managed) doesn't change much?
2. build a single OCaml module that has all the AST types in it (from
all the versions of OCaml)
• but without the form
┌────
│ type t = M.t = A of .. | B of ....
└────
that is, without the "type equation" that allows for a new
type-definition to precisely repeat a previous one.
3. Then use `ppx_import' against this single module to construct a
recursive type-declaration list of all the AST types for a
particular version of OCaml, and apply a "souped-up" version of
ppx_deriving.map to it, to map the types to *another* version of
the AST types.
• but `ppx_deriving.map' doesn't do this today, and besides, it
would have to provide a bunch of "escape hatches" for all the
special-cases I mentioned above.
But this is in principle doable, and it has the nice feature that all
the tedious boilerplate is mechanically-generated from
type-definitions, hence likely to not contain errors (assuming the PPX
rewriter isn't buggy).
So I decided to do it, and this little post is a result.
Discussion
╌╌╌╌╌╌╌╌╌╌
I think this is a quite viable approach to writing
`ocaml-migrate-parsetree', and I would encourage the PPX community to
consider it. One of the nice things about this approach, is that it
relies *heavily* on PPX rewriting itself, to get the job done. I
think one of the important things we've learned in programming
languages research, is that our tools need to be largely sufficient to
allow us to comfortably implement those same tools. It's a good test
of the PPX infrastructure, to see if you can take tedious tasks and
automate them away.
I'm not going to describe anymore of how this works, b/c I'd rather
get the rest of the migrations working, start figuring out how to
test, and get this code integrated with camlp5.
But for anybody who's interested, I'd be happy to interactively
describe the code and walk them thru how it works.
Louis Roché then asked
──────────────────────
For a person who hasn't digged into OMP, can you explain how it is
different from what is done currently? Because the idea I had of OMP
is basically what you describe, a set of functions transformation an
AST from vX to vX-1 and vX+1. So I am obviously missing something.
Chet Murthy replied
───────────────────
Yes, you're right: imagine a series of modules M2…M11. Each declares
the same set of types, but with different definitions, yes? Then
you'd have migration modules, `migrate_i_j' (j=i+1 or j=i-1) that have
functions that convert between the analogously-named types. The
entire question is: how are these functions implemented? By hand?
With significant mechanized support? They can't be implemented
fully-mechanically, because there are decisions to be made about how
to bridge differences in type-definitions. For instance, look at the
4.02 type `label' and the 4.03 type `arg_label'. Sometimes these are
analogous (and sometimes they're not). When they're analogous, the
code that converts between -cannot- be automatically inferred: a human
has to write it. But -most- of the code of these migration functions
can be inferred automatically from the type-definitions themselves.
And that's really all that my little experiment does: automatically
infer the migration code (most of the time) with some hints for those
cases where it's not possible to automatically infer.
Now, why would one do this? Well, two reasons:
1. it should be more maintainable to automatically generate most of
the code from types, and it should be quicker to bring online a
migration for a new version of the Ocaml AST.
2. this should be a good test of PPX rewriting. That is, if we're
going to build a macro-preprocessing support system, shouldn't it
be able to make solving such straightforward, but very tedious,
problems much, much easier?
Chet Murthy then added
──────────────────────
I forgot to add a third reason why this PPX-rewriter-based approach is
better:
1. If you look at ocaml-migrate-parsetree "migrations", you'll find
that they're almost all boilerplate code. But sprinkled
here-and-there, is actual logic, actual decisions about how to come
up with values for new fields, about which fields, when non-trivial
(e.g. not "[]") should lead to migration-failure, etc. It is this
code, that is the actual meat of the migration, and it's not at all
obvious, when sprinkled thru the mass of mechanically-produclble
boilerplate.
A mechanized production of that boilerplate would mean that we
retained explicitly only this nontrivial code, and hence for
maintenance we could focus on it, and make sure it does the right
thing.
Josh Berdine asked
──────────────────
Figuring out ways to make maintaining this stuff more efficient would
be great! One aspect that isn't clear to me is how this approach
compares to the process currently used to generate the omp code. I
haven't done it myself, but at first glance the tools to generate the
omp code (e.g. gencopy) seem to also accurately be describable as
heavily using ppx infrastructure in order to implement the map code
from one version to another. Is there an executive summary that
compares and contrasts that and this proposal?
Chet Murthy replied
───────────────────
From the README, gencopy is used to generate a prototype file for each
migration, and then a human goes in and fixes up the code. A way to
put my point is: gencopy should be provided the fixups in some compact
form, and apply them itself.
telltime - when is when exactly?
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-telltime-when-is-when-exactly/6372/1>
Darren announced
────────────────
I'm happy to announce release of [telltime] 0.0.1, a small cli tool
for interacting with Daypack-lib (a schedule, time, time slots
handling library) components.
It primarily answers time related queries, with support for union
(`||'), intersect (`&&') and "ordered select" (`>>', explanation of
this is at the bottom).
The query language, time expression, aims to mimic natural language,
but without ambiguity. The grammar is only documented in the online
demo [here] at the moment.
Some examples copied from the README are as follows.
[telltime] <https://github.com/daypack-dev/telltime>
[here] <https://daypack-dev.github.io/time-expr-demo/>
Search for time slots matching Daypack time expression
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
"Hm, I wonder what years have Febuary 29th?"
┌────
│ $ telltime search --time-slots 5 --years 100 "feb 29 00:00"
│ Searching in time zone offset (seconds) : 36000
│ Search by default starts from (in above time zone) : 2020 Sep 03 19:24:15
│
│ Matching time slots (in above time zone):
│ [2024 Feb 29 00:00:00, 2024 Feb 29 00:00:01)
│ [2028 Feb 29 00:00:00, 2028 Feb 29 00:00:01)
│ [2032 Feb 29 00:00:00, 2032 Feb 29 00:00:01)
│ [2036 Feb 29 00:00:00, 2036 Feb 29 00:00:01)
│ [2040 Feb 29 00:00:00, 2040 Feb 29 00:00:01)
└────
"Would be handy to know what this cron expression refers to"
┌────
│ $ telltime search --time-slots 5 "0 4 8-14 * *"
│ Searching in time zone offset (seconds) : 36000
│ Search by default starts from (in above time zone) : 2020 Sep 06 17:39:56
│
│ Matching time slots (in above time zone):
│ [2020 Sep 08 04:00:00, 2020 Sep 08 04:01:00)
│ [2020 Sep 09 04:00:00, 2020 Sep 09 04:01:00)
│ [2020 Sep 10 04:00:00, 2020 Sep 10 04:01:00)
│ [2020 Sep 11 04:00:00, 2020 Sep 11 04:01:00)
│ [2020 Sep 12 04:00:00, 2020 Sep 12 04:01:00)
└────
"I have a bunch of time ranges, but some of them overlap, and they are
not in the right order. If only there is a way to combine and sort
them easily."
┌────
│ $ telltime search --time-slots 1000 "2020 . jan . 1, 10, 20 . 13:00 to 14:00 \
│ || 2019 dec 25 13:00 \
│ || 2019 dec 25 10am to 17:00 \
│ || 2020 jan 5 10am to 1:30pm \
│ || 2020 . jan . 7 to 12 . 9:15am to 2:45pm"
│ Searching in time zone offset (seconds) : 36000
│ Search by default starts from (in above time zone) : 2020 Sep 06 18:01:12
│
│ Matching time slots (in above time zone):
│ [2019 Dec 25 10:00:00, 2019 Dec 25 17:00:00)
│ [2020 Jan 01 13:00:00, 2020 Jan 01 14:00:00)
│ [2020 Jan 05 10:00:00, 2020 Jan 05 13:30:00)
│ [2020 Jan 07 09:15:00, 2020 Jan 07 14:45:00)
│ [2020 Jan 08 09:15:00, 2020 Jan 08 14:45:00)
│ [2020 Jan 09 09:15:00, 2020 Jan 09 14:45:00)
│ [2020 Jan 10 09:15:00, 2020 Jan 10 14:45:00)
│ [2020 Jan 11 09:15:00, 2020 Jan 11 14:45:00)
│ [2020 Jan 12 09:15:00, 2020 Jan 12 14:45:00)
│ [2020 Jan 20 13:00:00, 2020 Jan 20 14:00:00)
└────
Get exact time after some duration from now
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ $ telltime from-now "1 hour"
│ Now : 2020-09-03 15:53:29
│ Duration (original) : 1 hour
│ Duration (normalized) : 1 hours 0 mins 0 secs
│ Now + duration : 2020-09-03 16:53:29
└────
┌────
│ $ telltime from-now "1.5 days 2.7 hours 0.5 minutes"
│ Now : 2020-09-03 15:55:43
│ Duration (original) : 1.5 days 2.7 hours 0.5 minutes
│ Duration (normalized) : 1 days 14 hours 42 mins 30 secs
│ Now + duration : 2020-09-05 06:38:13
└────
Difference between ordered select and union
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
`s1 >> s2' is similar to `s1 || s2', but `>>' picks between s1 and s2
in a round robin fashion, instead of just picking the smallest between
two.
One specific differing case would be when the search starts at 4pm
today, `3pm || 5pm' would return 5pm today and 3pm tomorrow, and so
on, while `3pm >> 5pm' would return 3pm tomorrow and 5pm tomorrow (a
5pm is only picked after a 3pm has been picked already).
Ocamlunit emacs minor-mode
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocamlunit-emacs-minor-mode/6373/1>
Manfred Bergmann announced
──────────────────────────
Here is a first version of this plugin that allows running `dune test'
with an Emacs key stroke. It shows the test result in a separate
buffer and a simple colorized status 'message'.
<https://github.com/mdbergmann/emacs-ocamlunit>
While it is possible to run `dune' in 'watch' mode I'd like to
manually run tests.
I didn't find a way to specify individual test modules in `dune'. Is
that possible?
Sihl 0.1.0
══════════
Archive: <https://discuss.ocaml.org/t/ann-sihl-0-1-0/6374/1>
jerben announced
────────────────
I am happy to announce this milestone release of Sihl, a web framework
for OCaml.
Github: <https://github.com/oxidizing/sihl>
opam: <http://opam.ocaml.org/packages/sihl/>
Sihl is really just a collection of services that can be plugged into
each other and a tiny core that knows how to start them. The goal is
to take care of infrastructure concerns so you can focus on the
domain.
After many iterations, the API is in a shape where we dare to show it
to you :slight_smile: It is still under heavy development so expect
breakage without a major version bump. However, we just finished
migrating a project from Reason on NodeJS to OCaml on Sihl, so we use
it in production.
We provide service implementations that were useful to us so far. In
the future we want to provide many more to cover all kinds of
needs. (PRs are always welcome!)
Any feedback is greatly appreciated, thanks! :)
jerben then added
─────────────────
Here is an example of a tiny Sihl app:
┌────
│ module Service = struct
│ module Random = Sihl.Utils.Random.Service
│ module Log = Sihl.Log.Service
│ module Config = Sihl.Config.Service
│ module Db = Sihl.Data.Db.Service
│ module MigrationRepo = Sihl.Data.Migration.Service.Repo.MariaDb
│ module Cmd = Sihl.Cmd.Service
│ module Migration = Sihl.Data.Migration.Service.Make (Cmd) (Db) (MigrationRepo)
│ module WebServer = Sihl.Web.Server.Service.Make (Cmd)
│ module Schedule = Sihl.Schedule.Service.Make (Log)
│ end
│
│ let services : (module Sihl.Core.Container.SERVICE) list =
│ [ (module Service.WebServer) ]
│
│ let hello_page =
│ Sihl.Web.Route.get "/hello/" (fun _ ->
│ Sihl.Web.Res.(html |> set_body "Hello!") |> Lwt.return)
│
│ let routes = [ ("/page", [ hello_page ], []) ]
│
│ module App = Sihl.App.Make (Service)
│
│ let _ = App.(empty |> with_services services |> with_routes routes |> run)
└────
promise_jsoo 0.1.0
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-promise-jsoo-0-1-0/6377/1>
Max LANTAS announced
────────────────────
Hello! I am announcing the first release of `promise_jsoo', a library
for JS promises in Js_of_ocaml.
<https://github.com/mnxn/promise_jsoo>
<https://opam.ocaml.org/packages/promise_jsoo/>
The library has bindings to the core `Promise' methods as well as
helper functions that make it easier to deal with a `Promise' of an
`option' or `result'. It is also possible to use this library with
[gen_js_api] to make for an easier JavaScript binding experience
Inspired by [aantron/promise], this library also uses indirection
internally when handling nested promises in order to ensure that the
bindings are type safe.
This project is part of ongoing work to port [vscode-ocaml-platform]
to Js_of_ocaml.
Generated documentation can be found [here].
[gen_js_api] <https://github.com/LexiFi/gen_js_api>
[aantron/promise]
<https://github.com/aantron/promise#discussion-how-reason-promise-makes-promises-type-safe>
[vscode-ocaml-platform]
<https://github.com/ocamllabs/vscode-ocaml-platform>
[here]
<https://mnxn.github.io/promise_jsoo/promise_jsoo/Promise/index.html>
Other OCaml News
════════════════
>From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Announcing Signals and Threads, a new podcast from Jane Street]
[OCaml Planet] <http://ocaml.org/community/planet/>
[Announcing Signals and Threads, a new podcast from Jane Street]
<https://blog.janestreet.com/announcing-signals-and-threads-index/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 48472 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-09-01 7:55 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-09-01 7:55 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 15200 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of August 25 to
September 01, 2020.
Table of Contents
─────────────────
Writing bindings for Google Apps Script (GAS)
What the Jane Street interns have wrought
a small library for shell/AWK/Perl-like scripting
letters 0.2.0
raylib-ocaml 0.1.0
OCaml Workshop 2020 Online Conference is live now
Other OCaml News
Old CWN
Writing bindings for Google Apps Script (GAS)
═════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/writing-bindings-for-google-apps-script-gas/6293/1>
Danielo Rodríguez announced
───────────────────────────
Thanks to the help of this community I successfully completed a crazy
idea: To write some ocaml functions to use inside [Google Apps Script]
for a small stupid spreadsheet that I had.
The way it works now is by having a main index.js file that calls the
Ocaml functions that are available under a global Lib
namespace. Everything is bundled using parcel and the Idea was to use
as few JS code as possible. Because it was easier than I expected I
decided to go one step further and write some bindings for the GAS
functions I was using and reduce the glue JS code even more.
This are the bindings that I wrote so far. They work, but are not
usable inside Ocaml yet.
┌────
│ type spreadsheet
│ type sheet
│ type range
│ external getActiveSpreadsheet : unit -> spreadsheet = "getActiveSpreadsheet" [@@bs.val][@@bs.scope
│ "SpreadsheetApp"]
│ external getSheets : spreadsheet -> sheet array = "getSheets" [@@bs.send]
│ external getSheetByName : spreadsheet -> string -> sheet = "getSheetByName" [@@bs.send]
│ external getDataRange : sheet -> range = "getDataRange" [@@bs.send]
│ external getValues : range -> 'a array array = "getValues" [@@bs.send]
└────
My doubt are on the edges. When it is just obscure GAS stuff I have no
doubt, abstract types and functions to interact with them. Is when a
GAS function returns data where I have doubts. Usually they are just
arrays of arrays of Numbers or Strings. In the example above, the last
definition says that you will get an array of arrays of `'a', but that
is not true because it will be an array of "stuff" (strings, numbers,
floats). How should I type it in a way that it's flexible but not
cumbersome? For example, I don't think using a functor will help
because you will need to create a functor for every possible return
type, in my case if you have 3 sheets with 3 different shapes, you
will need 3 functors. An alternative that I have used was to provide
some helper functions to convert from JS to Ocaml types and then
unwrap the Ocaml types, like the example I'm doing with
Number_or_string. This is nothing serious and I will just add the
bindings that I may need for now, but I want to hear what the
community (and potential users) thinks.
If anyone is interested in taking a look on the project, it is here:
<https://github.com/danielo515/ElectronicProjectsSpreadsheet>
[Google Apps Script] <https://developers.google.com/apps-script>
Matthieu Dubuget said
─────────────────────
Not answering directly to your question, sorry.
But here is a binding I have been using for around 4 years:
<https://dubuget.fr/gitea/matthieu/ocaml-google-app.git>.
Hongbo Zhang also replied
─────────────────────────
For return type polymorphism, you can use GADT with bs.ignore, the
rough idea:
┌────
│ type 'a t = Int : int t | String : string t
│ external f : ('a t [@bs.ignore]) -> ... -> 'a = "xx"
└────
I read discuss.ocaml.org from time to time, but checks
<https://forum.rescript-lang.org/> daily where you can get a quick
answer
What the Jane Street interns have wrought
═════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/what-the-jane-street-interns-have-wrought/6294/1>
Yaron Minsky announced
──────────────────────
I thought folks here might find this interesting:
<https://blog.janestreet.com/what-the-interns-have-wrought-2020/>
The post summarizes three of the intern projects that happened this
summer at Jane Street. It might be interesting if you're looking for
an internship (or know someone who is), or if you're interested in any
of the underlying tech. For example, if there's significant interest
in a library for writing OCaml, we'd be more likely to open-source it.
a small library for shell/AWK/Perl-like scripting
═════════════════════════════════════════════════
Archive:
<https://sympa.inria.fr/sympa/arc/caml-list/2020-08/msg00021.html>
Oleg announced
──────────────
Some time ago Chet Murthy asked about writing shell-like scripts in
OCaml. Prompted by it, I also want to report on my experience and
announce a small library that made it pleasant to do
shell/AWK/Perl-like scripting in OCaml.
The library is available at
<http://okmij.org/ftp/ML/myawk/0README.dr>
and consists of two small ML files, myawk.ml and strings.ml. The
latter collects general-purpose string operations, more convenient
than those in Stdlib.String. The rest of that web directory contains
half a dozen sample scripts with comments.
Here is the first example: a typical AWK script, but written in OCaml:
┌────
│ #!/bin/env -S ocaml
│
│ #load "myawk.cma"
│ open Myawk open Strings
│ let hash = string_of_int <|> Hashtbl.hash
│ ;;
│ (* Sanitize the files originally used by join1.ml and join2.ml
│ The files are made of space-separated fields; the first field is the
│ key. It is sensitive; but because it is a key it can't be replaced with
│ meaningless garbage. We obfuscate it beyond recognition. The third field
│ is obfuscated as well. The second and fourth can be left as they are,
│ and the fifth, if present, is replaced with XXX
│
│ The script is a proper filter: reads from stdin, writes to stdout
│ *)
│
│ for_each_line @@ map words @@ function (f1::f2::f3::f4::rest) ->
│ print [hash f1; f2; hash f3; f4; if rest = [] then "" else "XXX"]
│ ;;
└────
Here <|> is a function composition. I wish it were in Stdlib. The real
example, used in real life, was performing a database join
┌────
│ SELECT T2.* from Table1 as T1, Table2 as T2 where T1.f1 = T2.f1
└────
where Table1 and Table2 are text files with space-separated column
values. Table1 is supposed to be fed to stdin:
┌────
│ let () =
│ for_each_line @@ map words @@
│ map_option (function (x::_) -> Some x | _ -> None) @@
│ (ignore <|> shell "grep %s table1.txt")
└────
It is a typical rough-and-dirty script. Alas, it was too rough: I was
so excited that it typechecked and worked the first time, that I
didn't look carefully at the output and overlooked what I was looking
for (resulting in an unneeded hassle and apology). I should have
queried exactly for what I wanted:
┌────
│ SELECT T1.f1, T1.f4 FROM Table1 as T1, Table2 as T2
│ WHERE T1.f1 = T2.f1 AND T1.f3 <> "3"
└────
which is actually easy to write in myawk (probably not so in AWK
though)
┌────
│ let () =
│ for_each_line ~fname:"table2.txt" @@ map words @@
│ map_option (function (w::_) -> Some w | _ -> None) @@
│ fun w ->
│ for_each_line ~fname:"table1.txt" @@ map words @@
│ map_option (function
│ (x::f2::f3::f4::_) when x = w && f4 <> "3" -> Some [x;f4] | _ -> None) @@
│ print
└────
This is the classical nested loop join. Chet Murthy might be pleased
to see the extensive use of the continuation-passing style. I was
apprehensive at first, but it turned out not to be a hassle.
The library has a few other examples, including case-branching and
rewriting a real AWK script from the OCaml distribution.
Finally, let's compare with shell scripts. The example below doesn't
show off the library, but it does show the benefits of OCaml for
scripting. The original shell script is a sample GIT commit hook,
quoted in the comments:
┌────
│ (*
│ From GIT's sample hooks:
│ ANY-GIT-REPO/.git/hooks/commit-msg.sample
│
│ # Called by "git commit" with one argument, the name of the file
│ # that has the commit message. The hook should exit with non-zero
│ # status after issuing an appropriate message if it wants to stop the
│ # commit. The hook is allowed to edit the commit message file.
│
│ # This example catches duplicate Signed-off-by lines.
│
│ test "" = "$(grep '^Signed-off-by: ' "$1" |
│ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
│ echo >&2 Duplicate Signed-off-by lines.
│ exit 1
│ }
│
│ *)
│ module H = Hashtbl
│
│ let commit_msg = Sys.argv.(1)
│ let ht = H.create 5
│ let () =
│ for_each_line ~fname:commit_msg @@ fun l ->
│ if is_prefix "Signed-off-by: " l <> None then begin
│ if H.find_opt ht l <> None then begin
│ prerr_endline "Duplicate Signed-off-by lines.";
│ exit 1
│ end else
│ H.add ht l ()
│ end
└────
Although the OCaml script seems to have more characters, one doesn't
need to type them all. Scripts like that are meant to be entered in an
editor; even ancient editors have completion facilities.
Looking at the original shell script brings despair, and drives me
right towards Unix Haters. Not only the script is algorithmically
ugly: if a duplicate signed-off line occurs near the beginning, we can
report it right away and stop. We don't need to read the rest of the
commit message, filter it, sort it, precisely count all duplicates and
filter again. Not only the script gratuitously wastes system resources
(read: the laptop battery) by launching many processes and allocating
communication buffers. Mainly, the script isn't good at its primary
purpose: it isn't easy to write and read. Pipeline composition of
small stream processors is generally a good thing – but not when each
stream processor is written in its own idiosyncratic
language. Incidentally, I have doubts about the script: I think that
quotes around $1 are meant to be embedded; but why they are not
escaped then? Probably it is some edge case of bash, out of several
0thousands.
In contrast, OCaml script does exactly what is required, with no extra
work. Everything is written in only one language.
letters 0.2.0
═════════════
Archive: <https://discuss.ocaml.org/t/ann-letters-0-2-0/6307/1>
Miko announced
──────────────
Getting this release done took a bit longer than expected due to some
real life factors, but finally here it is.
This one mainly focuses on the most requested features and
improvements like simplifying configuration around CA certificates,
provides some basic documentation and additionally adds support for
`multipart/alternative' emails with combined HTML and plain text
content.
jerben then added
─────────────────
Link to Github: <https://github.com/oxidizing/letters>
raylib-ocaml 0.1.0
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-raylib-ocaml-0-1-0/6313/1>
Tobias Mock announced
─────────────────────
I'd like to announce the first version of [raylib-ocaml], a binding to
the awesome [raylib] game development library. The release can be
found on opam as ["raylib"].
The bindings are nearly complete, as far as functions and types go,
but only a subset was tested so far. I will work on bringing more of
the numerous examples of the C version to OCaml in the future.
Currently, raylib-ocaml only works on Linux, but I plan to support
Windows (and possibly other targets) in the future.
Feel free to give it a spin and please report any issues you run into.
[raylib-ocaml] <https://github.com/tjammer/raylib-ocaml>
[raylib] <https://www.raylib.com/>
["raylib"] <https://opam.ocaml.org/packages/raylib/>
OCaml Workshop 2020 Online Conference is live now
═════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-workshop-2020-online-conference-is-live-now/6287/30>
Deep in this thread, Didier Wenzek announced
────────────────────────────────────────────
[OCaml 2020 All Videos]
[OCaml 2020 All Videos]
<https://www.youtube.com/playlist?list=PLKO_ZowsIOu5fHjRj0ua7_QWE_L789K_f>
Other OCaml News
════════════════
>From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [BuckleScript Good and Bad News]
• [What the interns have wrought, 2020 edition]
• [Coq 8.12.0 is out]
[OCaml Planet] <http://ocaml.org/community/planet/>
[BuckleScript Good and Bad News]
<http://psellos.com/2020/08/2020.08.east-van-girls.html>
[What the interns have wrought, 2020 edition]
<https://blog.janestreet.com/what-the-interns-have-wrought-2020/>
[Coq 8.12.0 is out] <https://coq.inria.fr/news/coq-8-12-0-is-out.html>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 34062 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-08-18 7:25 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-08-18 7:25 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 7186 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of August 11 to 18,
2020.
Table of Contents
─────────────────
Ppx: omp 2.0.0 and next steps
Old CWN
Ppx: omp 2.0.0 and next steps
═════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ppx-omp-2-0-0-and-next-steps/6231/1>
Jérémie Dimino announced
────────────────────────
quick summary:
• ocaml-migrate-parsetree 2.0.0 release
• you should add a upper bound in your dev repos
• ppxlib compatible version coming soon
• ppxlib is now the official ppx library supported by the OCaml
platform
Hi everyone,
As [previously announced], we are [releasing the version 2.0.0 of
ocaml-migrate-parsetree]. At the moment nothing is compatible with the
new version and we will soon release a version of ppxlib that is
compatible with it. If your project depends on
ocaml-migrate-parsetree, you should add a upper bound to your
development repository.
If you plan to use ocaml-migrate-parsetree 2.0.0 directly, please note
however that this is a transitory package. The technology implemented
by ocaml-migrate-parsetree will live on and hopefully find a new home
in the compiler repository proper. However, ocaml-migrate-parsetree as
a standalone project will eventually stop being maintained.
I am also taking the opportunity to announce that *ppxlib is the first
ppx library officially supported by the OCaml platform*, and the one
we recommend all ppx authors to use. It is the library that we plan to
maintain for the long term.
Other libraries such as `ppx_tools' or `ppx_tools_versioned' may
continue to be maintained by open source contributors, however they
will not be maintained by the OCaml platform and will not receive
updates from the platform when new compilers are released. Only ppxlib
will receive updates from the platform.
If you would like to port your project to use ppxlib and are
experiencing difficulties or have any question, please get in touch by
replying to this post or opening a ticket on
<https://github.com/ocaml-ppx/ppxlib>.
The overall plan described in this post is the result of various
discussions and/or collaborative effort between the following people:
@avsm, @ceastlund, @Drup, @gasche, @jeremiedimino, @kit-ty-kate,
@let-def, @NathanReb and @pitag.
[previously announced]
<https://discuss.ocaml.org/t/ocaml-migrate-parsetree-2-0-0/5991>
[releasing the version 2.0.0 of ocaml-migrate-parsetree]
<https://github.com/ocaml/opam-repository/pull/16999>
Next steps
╌╌╌╌╌╌╌╌╌╌
As soon as the new version of ppxlib is released, we will work towards
our next milestone. As a reminder, our current goal is to setup a ppx
ecosystem that is continously compatible with the trunk of OCaml. To
achieve that goal, we plan to add a stable API called "Astlib" on top
of the compiler libraries. To keep things sustainable on the compiler
side and increase flexibility, Astlib will be minimal and will be
targeted at ppxlib only rather than be a general API aimed at ppx
authors.
The difficulty of this API is that it must expose a stable interface
to the OCaml AST, which is composed of a large collection of data
types. To make it work, we plan to use the technology developed in
ocaml-migrate-parsetree; i.e. whole AST migration functions.
While we eventually want Astlib to live in the compiler repository, we
will initially develop it inside the ppxlib repository. Once it is
ready, we will submit it for inclusion in the compiler. Although, we
will keep a copy inside ppxlib for older versions of the compiler.
We also plan to setup a smooth workflow for compiler developers to
update Astlib when they change the development AST.
Once this is all done, we will be in a situation where the ppx
ecosystem is compatible with the trunk of OCaml at all time. And as a
result, new releases of the compiler will no longer break ppx packages
as long as they limit themselves to the ppxlib API.
Future
╌╌╌╌╌╌
While this work will make the ecosystem compatible with the trunk of
OCaml at all times, it will essentially move the backward
compatibility issue from the compiler to ppxlib.[1] This will already
give us a lot more flexibility as for instance a single version of
ppxlib can be compatible with a wide range of OCaml versions. However,
we recognise that it is not usual to ask a community to rely on an
unstable API.
We made this choice as a trade-off between sustainability and
complexity. Indeed, we want to maintain Astlib and Ppxlib over the
long term and the best way to make things sustainable is to use simple
and clear designs. While we do have solutions in our sleeves that
would provide a fully stable ppx API, these are much more complicated
to maintain and work with.
To mitigate this, we are setting up a Dune based workflow to upgrade
all ppx rewriters at once. So once the system is rolling and if your
ppx rewriters are up to date and using Dune, you should expect to
receive pull requests as we update ppxlib. This last part will take
some time to be fully rolling, so please bear with us :)
In any case, about a year after this new world is fully setup, we will
review the situation and decide whether it is sustainable or whether
we need to go all the way and mint a fully stable ppx API.
Timeline
╌╌╌╌╌╌╌╌
• today: ocaml-migrate-parsetree 2.0.0 is being released
• next week: a ppxlib compatible version is released
• December 2020: astlib is ready inside the ppxlib repository
• next OCaml release after that: astlib lives in the compiler
• September 2021: we review the situation and decide what to do next
[1]: At any given time the API of ppxlib refer to a single version of
the OCaml AST. In order to allow OCaml users to enjoy both ppx
rewriters and new language features, the version of the AST selected
by ppxlib needs to be bumped after each release of the compiler, which
is a breaking change that has the potential to break several ppx
packages. As a result, ppx packages will still need to be regularly
updated in order to stay compatible with the latest version of ppxlib.
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 18147 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-07-28 16:57 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-07-28 16:57 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
[-- Attachment #2.1: Type: text/plain, Size: 23258 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of July 21 to 28,
2020.
As I will be away with no internet next week, the next CWN will be on
August 11.
Table of Contents
─────────────────
Embedded ocaml templates
Proposal: Another way to debug memory leaks
Camlp5 (8.00~alpha01) and pa_ppx (0.01)
OCaml 4.11.0, third (and last?) beta release
Other OCaml News
Old CWN
Embedded ocaml templates
════════════════════════
Archive: [https://discuss.ocaml.org/t/embedded-ocaml-templates/6124/1]
Emile Trotignon announced
─────────────────────────
I am very happy to announce the release of ocaml-embedded-templates.
This is a tool similar to camlmix, but camlmix was not updated for 7
years, and there is no easy way to handle a lot of templates (my
command takes a directory as an argument and generate an ocaml module
by going through the directory recursively) I also choosed to use a
syntax similar to EJS, and there is a ppx for inline EML.
You can check it out here :
[https://github.com/EmileTrotignon/embedded_ocaml_templates]
Here is a more extensive exemple of what can be done with this :
[https://github.com/EmileTrotignon/resume_of_ocaml] (This project
generate my resume/website in both latex and html).
This is my first opam package : feedback is very much welcome.
Proposal: Another way to debug memory leaks
═══════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/proposal-another-way-to-debug-memory-leaks/6134/1]
Jim Fehrle said
───────────────
`memprof' helps you discover where memory was allocated, which is
certainly useful. However, that may not be enough information to
isolate a leak. Sometimes you'd like to know what variables refer to
excessive amounts of memory.
For this, you'd want to examine all the garbage collection roots and
report how much memory is used by each. This is useful information if
you can map a GC root back to a source file and variable.
I prototyped code to do that to help with Coq bug
[https://github.com/coq/coq/issues/12487]. It localized several leaks
enough across over 500 source files so that we could find and fix
them. But my prototype code is a bit crude. I'd like to clean it up
and submit it as a PR. Since this could be done in various ways, I
wanted to get some design/API feedback up front rather than maybe
doing some of it twice. Also I'd like to confident that such a PR
would be accepted and merged in a reasonable amount of time–otherwise
why bother.
[caml_do_roots] shows how to access the GC roots. There are several
types of roots:
• global roots, corresponding to top-level variables in source files
• dynamic global roots
• stack and local roots
• global C roots
• finalized values
• memprof
• hook
*API (in Gc):*
┌────
│ val print_global_reachable : out_channel -> int -> unit
└────
Prints a list to `out_channel' of the global roots that reach more
than the specified number of words. Each item shows the number of
reachable words, the associated index of the root in the `*glob' for
that file and the name of the source file.
Something like this (but with only filenames rather than pathnames):
┌────
│ 102678 field 17 plugins/ltac/pltac.ml
│ 102730 field 18 plugins/ltac/pltac.ml
│ 164824 field 20 plugins/ltac/tacenv.ml
│ 1542857 field 26 plugins/ltac/tacenv.ml
│ 35253743 field 65 stm/stm.ml
│ 35201913 field 8 vernac/vernacstate.ml
│ 8991864 field 24 vernac/library.ml
│ 112035 field 8 vernac/egramml.ml
│ 6145454 field 84 vernac/declaremods.ml
│ 6435878 field 89 vernac/declaremods.ml
└────
I would use ELF information in the binary file to map from `*glob'
back to a filename. For example, the address symbol of the entry
`camlTest' corresponds to `test.ml'. This would only work for binary
executables compiled with the `-g' option. It wouldn't work for
byte-compiled code. It would print an error message if it's not ELF
or not `-g'. Also, being a little lazy, how essential is it to
support 32-bit binaries? (Q: What happens if you have 2 source files
with the same name though in different directories? Would the symbol
table distinguish them?)
┌────
│ val get_field_index : Obj.t -> int
└────
Returns the `*glob' index number for the top-level variable (passed as
`Obj.repr var'). I expect there's no way to recover variable names
from the `*glob' index. In my experiments, it appeared that the
entries in `*glob' were in the same order as as the variable and
function declarations. This would let a developer do a binary search
in the code to locate the variable which it probably a necessity for
large, complex files such as Coq's `stm.ml'–3300 lines, 10+ modules
defined within the file. (I noticed that variables defined in modules
defined within the source file were not in `*glob'. I expect there is
a root for the module as a whole and that those variables can be
readily found within that root.)
This would need an extended explanation in `gc.mli'.
┌────
│ val print_stack_reachable : out_channel -> int -> unit
└────
Prints a backtrace to `out_channel' that also shows which roots for
each frame reach more than the specified number of words. (I'd keep
the "item numbers" since there's no way to translate them to variables
and they might give some clues.)
┌────
│ Called from file "tactics/redexpr.ml" (inlined), line 207, characters 29-40
│ 356758154 item 0 (stack)
│ Called from file "plugins/ltac/tacinterp.ml", line 752, characters 6-51
│ 17646719 item 0 (stack)
│ 119041 item 1 (stack)
│ Called from file "engine/logic_monad.ml", line 195, characters 38-43
│ 119130 item 0 (stack)
│ 373378237 item 1 (stack)
└────
As it turns out, 90% of the memory in Coq issue mentioned above is
reachable only from the stack.
I didn't consider the other types of roots yet, which I don't fully
understand, such as local roots. Just covering global and stack roots
seems like a good contribution. Dynamic global roots may be easy to
add if they are otherwise similar to global roots. For the others I
could print the reachable words, but I don't know how to direct the
developer to look at the relevant part of the code, especially if it's
in C code. I suppose `print_global_reachable' and
`print_stack_reachable' could be a single routine as well. That's
probably better.
Let me know your thoughts.
[caml_do_roots]
https://github.com/ocaml/ocaml/blob/80326033cbedfe59c0664e3912f21017e968a1e5/runtime/roots_nat.c#L399
Camlp5 (8.00~alpha01) and pa_ppx (0.01)
═══════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-camlp5-8-00-alpha01-and-pa-ppx-0-01/6144/1]
Chet Murthy announced
─────────────────────
`Camlp5 (8.00~alpha01)' and `pa_ppx (0.01)'
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
I'm pleased to announce the release of two related projects:
1. [Camlp5]: version 8.00~alpha01 is an alpha release of Camlp5, with
full support for OCaml syntax up to version 4.10.0, as well as
minimal compatibility with version 4.11.0. In particular there is
full support for PPX attributes and extensions.
2. [pa_ppx]: version 0.01 is a re-implementation of a large number of
PPX rewriters (e.g. ppx_deriving (std (show, eq, map, etc), yojson,
sexp, etc), ppx_import, ppx_assert, others) on top of Camlp5, along
with an infrastructure for developing new ones.
This allows projects to combine the existing style of Camlp5 syntax
extension, with PPX rewriting, without having to jump thru hoops to
invoke camlp5 on some files, and PPX processors on others.
Camlp5 alone is not compatible with existing PPX rewriters: Camlp5
syntax-extensions (e.g. "stream parsers") would be rejected by the
OCaml parser, and PPX extensions/attributes are ignored by Camlp5
(again, without `pa_ppx'). `pa_ppx' provides Camlp5-compatible
versions of many existing PPX rewriters, as well as new ones, so that
one can use Camlp5 syntax extensions as well as PPX rewriters. In
addition, some of the re-implemented rewriters are more-powerful than
their original namesakes, and there are new ones that add interesting
functionality.
[Camlp5] https://github.com/camlp5/camlp5
[pa_ppx] https://github.com/chetmurthy/pa_ppx
For democratizing macro-extension-authoring in OCaml
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
TL;DR Writing OCaml PPX rewriters is *hard work*. There is a
complicated infrastructure that is hard to explain, there are multiple
such incompatible infrastructures (maybe these are merging?) and it is
hard enough that most Ocaml programmers do not write macro-extensions
as a part of their projects. I believe that using Camlp5 and pa_ppx
can make it easier to write macro-extensions, via:
1. providing a simple way of thinking about adding your extension to
the parsing process.
2. providing transparent tools (e.g. quotations) for
pattern-matching/constructing AST fragments
Explained below in [Macro Extensions with
Pa_ppx](#macro-extensions-with-pa_ppx).
◊ The original arguments against Camlp4
The original argument against using Camlp4 as a basis for
macro-preprocessing in Ocaml, had several points (I can't find the
original document, but from memory):
1. *syntax-extension* as the basis of macro-extension leads to brittle
syntax: multiple syntax extensions often do not combine well.
2. a different AST type than the Ocaml AST
3. a different parsing/pretty-printing infrastructure, which must be
maintained alongside of Ocaml's own parser/pretty-printer.
4. A new and complicated set of APIs are required to write syntax
extensions.
To this, I'll add
1. Camlp4 was *forked* from Camlp5, things were changed, and hence,
Camlp4 lost the contribution of its original author. Hence,
maintaining Camlp4 was always labor that fell on the Ocaml
team. [Maybe this doesn't matter, but it counts for something.]
◊ Assessing the arguments, with some hindsight
1. *syntax-extension* as the basis of macro-extension leads to brittle
syntax: multiple syntax extensions often do not combine well.
In retrospect, this is quite valid: even if one prefers and enjoys
LL(1) grammars and parsing, when multiple authors write
grammar-extensions which are only combined by third-party projects,
the conditions are perfect for chaos, and of a sort that
project-authors simply shouldn't have to sort out. And this chaos
is of a different form, than merely having two PPX rewriters use
the same attribute/extension-names (which is, arguably, easily
detectable with some straightforward predeclaration).
2. Camlp4/5 has a different AST type than the Ocaml AST
Over time, the PPX authors themselves have slowly started to
conclude that the current reliance on the Ocaml AST is fraught with
problems. The "Future of PPX" discussion thread talks about using
something like s-expressions, and more generally about a
more-flexible AST type.
3. a different parsing/pretty-printing infrastructure, which must be
maintained alongside of Ocaml's own parser/pretty-printer.
A different AST type necessarily means a different
parser/pretty-printer. Of course, one could modify Ocaml's YACC
parser to produce Camlp5 ASTs, but this is a minor point.
4. A new and complicated set of APIs are required to write syntax
extensions.
With time, it's clear that PPX has produced the same thing.
5. Maintaining Camlp4 was always labor that fell on the Ocaml team.
The same argument (that each change to the Ocaml AST requires work
to update Camlp5) can be made for PPX (specifically, this is the
raison d'etre of ocaml-migrate-parsetree). Amusingly, one could
imagine using ocaml-migrate-parsetree as the basis for making
Camlp5 OCaml-version-independent, too. That is, the "backend" of
Camlp5 could use ocaml-migrate-parsetree to produce ASTs for a
version of OCaml different from the one on which it was compiled.
Arguments against the current API(s) of PPX rewriting
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The overall argument is that it's too complicated for most OCaml
programmers to write their own extensions; what we see instead of a
healthy ecosystem of many authors writing and helping-improve PPX
rewriters, is a small number of rewriters, mostly written by Jane
Street and perhaps one or two other shops. There are a few big
reasons why this is the case (which correspond to the responses
above), but one that isn't mentioned is:
1. When the "extra data" of a PPX extension or attribute is
easily-expressed with the fixed syntax of PPX payloads, all is
`~well~' ok, but certainly not in great shape. Here's an example:
┌────
│ type package_type =
│ [%import: Parsetree.package_type
│ [@with core_type := Parsetree.core_type [@printer Pprintast.core_type];
│ Asttypes.loc := Asttypes.loc [@polyprinter fun pp fmt x -> pp fmt x.Asttypes.txt];
│ Longident.t := Longident.t [@printer pp_longident]]]
│ [@@deriving show]
└────
The expression-syntax of assignment is used to express type-expression
rewrites. And this is necesarily limited, because we cannot (for
example) specify left-hand-sizes that are type-expressions with
variables. It's a perversion of the syntax, when what we really want
to have is something that is precise: "map this type-expression to
that type-expression".
Now, with the new Ocaml 4.11.0 syntax, there's a (partial) solution:
use "raw-string-extensions" like `{%foo|argle|}'. This is the same as
`[%foo {|argle|}]'. This relies on the PPX extension to parse the
payload. But there are problems:
1. Of course, there's no equivalent `{@foo|argle|}' (and "@@", "@@@"
of course) for attributes.
2. If the payload in that string doesn't *itself* correspond to some
parseable Ocaml AST type, then again, we're stuck: we have to
cobble together a parser instead of being able to merely extend the
parser of Ocaml to deal with the case.
Note well that I'm not saying that we should extend the parsing rules
of the Ocaml language. Rather, that with an *extensible parser*
(hence, LL(1)) we can add new nonterminals, add rules that reference
existing nonterminals, and thereby get an exact syntax (e.g.) for the
`ppx_import' example above. That new nonterminal is used *only* in
parsing the payload – nowhere else – so we haven't introduced examples
of objection #1 above.
And it's not even very hard.
Macro Extensions with Pa_ppx
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The basic thesis of `pa_ppx' is "let's not throw the baby out with the
bathwater". Camlp5 has a lot of very valuable infrastructure that can
be used to make writing macro-preprocessors much easier. `pa_ppx'
adds a few more.
1. Quotations for patterns and expressions over all important OCaml
AST types.
2. "extensible functions" to make the process of recursing down the
AST transparent, and the meaning of adding code to that process
equally transparent.
3. `pa_ppx' introduces "passes" and allows each extension to register
which other extensions it must follow, and which may follow it;
then `pa_ppx' topologically sorts them, so there's no need for
project-authors to figure out how to order their PPX extension
invocations.
As an example of a PPX rewriter based on `pa_ppx', here's
[pa_ppx.here] from the `pa_ppx' tutorial. In that example, you'll see
that Camlp5 infrastructure is used to make things easy:
1. quotations are used to both build the output AST fragment, and to
pattern-match on inputs.
2. the "extensible functions" are used to add our little bit of
rewriter to the top-down recursion.
3. and we declare our rewriter to the infrastructure (we don't specify
what passes it must come before or after, since `pa_ppx.here' is so
simple).
[pa_ppx.here]
https://pa-ppx.readthedocs.io/en/latest/tutorial.html#an-example-ppx-rewriter-based-on-pa-ppx
Conclusion
╌╌╌╌╌╌╌╌╌╌
I'm not trying to convince you to switch away from PPX to Camlp5.
Perhaps, I'm not even merely arguing that you should use `pa_ppx' and
author new macro-extensions on it. But I *am* arguing that the
features of
1. quotations, with antiquotations in as many places as possible, and
hence, *in places where Ocaml identifiers are not permitted*.
2. facilities like "extensible functions", with syntax support for
them
3. a new AST type, that is suitable for macro-preprocessing, but isn't
merely "s-expressions" (after all, there's a reason we all use
strongly-typed languages)
4. an extensible parser for the Ocaml language, usable in PPX
attribute/extension payloads
are important and valuable, and a PPX rewriter infrastructure that
makes it possible for the masses to write their own macro-extensions,
is going to incorporate these things.
OCaml 4.11.0, third (and last?) beta release
════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-4-11-0-third-and-last-beta-release/6149/1]
octachron announced
───────────────────
The release of OCaml 4.11.0 is near. As one step further in this
direction, we have published a third and potentially last beta
release.
This new release fixes an infrequent best-fit allocator bug and an
issue with floating-point software emulation in the ARM EABI port. On
the ecosystem side, merlin is now available for this new version of
OCaml. The compatibility of the opam ecosystem with OCaml 4.11.0 is
currently good, and it should be possible to test this beta without
too much trouble.
The source code is available at these addresses:
[https://github.com/ocaml/ocaml/archive/4.11.0+beta3.tar.gz]
[https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-4.11.0+beta3.tar.gz]
The compiler can also be installed as an OPAM switch with one of the
following commands:
┌────
│ opam update
│ opam switch create ocaml-variants.4.11.0+beta3 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
or
┌────
│ opam update
│ opam switch create ocaml-variants.4.11.0+beta3+VARIANT --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where you replace VARIANT with one of these: afl, flambda, fp,
fp+flambda
We would love to hear about any bugs. Please report them here:
[https://github.com/ocaml/ocaml/issues]
Compared to the previous beta release, the exhaustive list of changes
is as follows:
Runtime:
╌╌╌╌╌╌╌╌
• [#9736], [#9749]: Compaction must start in a heap where all free
blocks are blue, which was not the case with the best-fit
allocator. (Damien Doligez, report and review by Leo White)
• + [*new bug fixes*] [#9316], [#9443], [#9463], [#9782]: Use typing
information from Clambda or mutable Cmm variables. (Stephen Dolan,
review by Vincent Laviron, Guillaume Bury, Xavier Leroy, and Gabriel
Scherer; temporary bug report by Richard Jones)
[#9736] https://github.com/ocaml/ocaml/issues/9736
[#9749] https://github.com/ocaml/ocaml/issues/9749
[#9316] https://github.com/ocaml/ocaml/issues/9316
[#9443] https://github.com/ocaml/ocaml/issues/9443
[#9463] https://github.com/ocaml/ocaml/issues/9463
[#9782] https://github.com/ocaml/ocaml/issues/9782
Manual and documentation:
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• [#9541]: Add a documentation page for the instrumented runtime;
additional changes to option names in the instrumented
runtime. (Enguerrand Decorne, review by Anil Madhavapeddy, Gabriel
Scherer, Daniel Bünzli, David Allsopp, Florian Angeletti, and
Sébastien Hinderer)
Entries marked with "+" were already present in previous alphas, but
they have been complemented by new bug fixes.
If you are interested by the list of new features, and the nearly
final list of bug fixes the updated change log for OCaml 4.11.0 is
available at:
[https://github.com/ocaml/ocaml/blob/4.11/Changes]
[#9541] https://github.com/ocaml/ocaml/issues/9541
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Frama-Clang 0.0.9 is out. Download it here.]
[OCaml Planet] http://ocaml.org/community/planet/
[Frama-Clang 0.0.9 is out. Download it here.]
http://frama-c.com/index.html
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2.2: Type: text/html, Size: 37178 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-07-21 14:42 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-07-21 14:42 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 7349 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of July 14 to 21,
2020.
Table of Contents
─────────────────
Dune-release: version 1.4.0 released
Using AF_XDP sockets for high-performance packet processing in OCaml
Ubase 0.03
clangml 4.2.0: OCaml bindings for Clang API (for C and C++ parsing)
Old CWN
Dune-release: version 1.4.0 released
════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/dune-release-version-1-4-0-released/6103/1]
Sonja Heinze announced
──────────────────────
This post is about [dune-release], a tool that helps users release
their packages to Opam in a fast and organized manner. You can install
it via `opam install dune-release'.
On behalf of the dune-release team at Tarides, I'm happy to announce
the new dune-release [1.4.0 release]. The release includes two new
subcommands described below and a variety of bug fixes and user
experience improvements. In particular, we've put some work into
improving the error handling and reporting.
One of the new subcommands is `dune-release config' , which inspects
and edits dune-release's global configuration, such as git related,
opam related and github related data. For example, if you insert a
typo when being asked for your github id during your first release
with dune-release, you can correct it comfortably with that new
subcommand.
The other new subcommand is `dune-release delegate-info', which helps
users with an alternative release workflow to integrate dune-release
into it: imagine you want to use dune-release only for a couple of
things, such as tagging the distribution and creating the distribution
tarball and the documentation. In that case, now you can integrate
the work done by dune-release into your individual release workflow by
accessing the path to the created tarball etc via `dune-release
delegate-info'. It forms part of the broader change in progress
described in the following post:
[https://discuss.ocaml.org/t/replacing-dune-release-delegates/4767]
[dune-release] https://github.com/ocamllabs/dune-release/#readme
[1.4.0 release]
https://github.com/ocamllabs/dune-release/releases/tag/1.4.0
Using AF_XDP sockets for high-performance packet processing in OCaml
════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/using-af-xdp-sockets-for-high-performance-packet-processing-in-ocaml/6106/1]
suttonshire announced
─────────────────────
I just wanted to share a fun result from a project I've been hacking
on. [ocaml-xsk] is a binding to AF_XDP interface of libbpf.
AF_XDP is an address family in Linux for high-performance packet
processing. With an AF_XDP socket a packet bypasses most of the kernel
networking stack and is passed directly to userspace program.
Depending on the configuration packets can be passed from the NIC
without any data copies on either Rx or Tx. If you're interested in
this kind of stuff here are a couple very useful resources:
• [https://github.com/torvalds/linux/blob/master/Documentation/networking/af_xdp.rst]
• [https://github.com/xdp-project/xdp-tutorial/tree/master/advanced03-AF_XDP]
The cool part is that without installing large dependencies like DPDK
you can get packets into your program basically as fast as your NIC
can provide them! It turns out this is true even if your program is
written in OCaml. Using ocaml-xsk I could receive or transmit 64 byte
UDP packets at 14.8M packets per second. This is the limit for a
10Gb/s NIC.
I'm still trying to figure out the best interface for AF_XDP. There
are several resources to manage, and simple receive and transmit
operations actually require a few steps. But it's encouraging know
OCaml doesn't get in the way of packet throughput.
[ocaml-xsk] https://github.com/suttonshire/ocaml-xsk
Ubase 0.03
══════════
Archive: [https://discuss.ocaml.org/t/ann-ubase-0-03/6115/1]
sanette announced
─────────────────
I'm happy to announce the release of [ubase], a tiny library whose
only purpose is to remove diacritics (accents, etc.) from utf8-encoded
strings using the latin alphabet.
It was created after the discussion:
[https://discuss.ocaml.org/t/simplify-roman-utf8/4398].
It's now available from `opam':
`opam install ubase'
This also installs an executable that you may use in a shell, for
instance:
┌────
│ $ ubase "et grønt træ"
│ et gront trae
│
│ $ ubase Anh xin lỗi các em bé vì đã đề tặng cuốn sách này cho một ông người lớn.
│ Anh xin loi cac em be vi da de tang cuon sach nay cho mot ong nguoi lon.
└────
More info [here].
[ubase] https://github.com/sanette/ubase
[here] https://sanette.github.io/ubase/
clangml 4.2.0: OCaml bindings for Clang API (for C and C++ parsing)
═══════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-clangml-4-2-0-ocaml-bindings-for-clang-api-for-c-and-c-parsing/6123/1]
Thierry Martinez announced
──────────────────────────
We are happy to announce the new clangml 4.2.0 release. Clangml
provides bindings for all versions of Clang, from 3.4 to the not yet
released 10.0.1.
The library can be installed via opam: `opam install clangml' The
documentation is online:
[https://memcad.gitlabpages.inria.fr/clangml/]
This new release improves C++ support, including C++20 specific
constructs.
All Clang C/C++ attributes should now be supported. You may have a
look to the interface of the new auto-generated module [`Attributes'].
There is now a lazy version of the AST (`Clang.Lazy.Ast'): this is
useful to explore large ASTs efficiently (note that Clang parsing
itself can still be slow; the lazy part only concerns the conversion
into the `Clang.Lazy.Ast' datatypes).
[`Attributes']
https://memcad.gitlabpages.inria.fr/clangml/doc/clangml/Clang__/Attributes/
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2: Type: text/html, Size: 18807 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-07-14 9:54 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-07-14 9:54 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 7882 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of July 07 to 14,
2020.
Table of Contents
─────────────────
OCaml 4.11.0, second beta release
letters - simple client abstractions for sending emails over SMTP
A question about Ocaml
Alcotest 1.2.0
Set up OCaml 1.1.0
Old CWN
OCaml 4.11.0, second beta release
═════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-4-11-0-second-beta-release/6063/1]
octachron announced
───────────────────
The release of OCaml 4.11.0 is approaching. As one step further in
this direction, we have published a second beta release. This new
release fixes an MSVC-specific runtime issue.
The compatibility of the opam ecosystem with OCaml 4.11.0 is currently
quite good with only 7 packages not currently available, and it should
be possible to test this beta without too much trouble.
The source code is available at these addresses:
[https://github.com/ocaml/ocaml/archive/4.11.0+beta2.tar.gz]
[https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-4.11.0+beta2.tar.gz]
The compiler can also be installed as an OPAM switch with one of the
following commands:
┌────
│ opam switch create ocaml-variants.4.11.0+beta2 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
or
┌────
│ opam switch create ocaml-variants.4.11.0+beta2+<VARIANT> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where you replace <VARIANT> with one of these: afl, flambda, fp,
fp+flambda
We would love to hear about any bugs. Please report them here:
[https://github.com/ocaml/ocaml/issues]
If you are interested by the list of new features, and the on-going
list of bug fixes the updated change log for OCaml 4.11.0 is available
at:
[https://github.com/ocaml/ocaml/blob/4.11/Changes]
Compared to the previous beta release, the exhaustive list of changes
is as follows:
Runtime
╌╌╌╌╌╌╌
• [#9714], [#9724]: Use the C++ alignas keyword when compiling in
C++. Fixes a bug with MSVC C++ 2015/2017. Add a terminator to the
`caml_domain_state' structure to better ensure that members are
correctly spaced. (Antonin Décimo, review by David Allsopp and
Xavier Leroy)
[#9714] https://github.com/ocaml/ocaml/issues/9714
[#9724] https://github.com/ocaml/ocaml/issues/9724
Manual and documentation
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• [#8644]: fix formatting comment about @raise in stdlib's mli files
(Élie Brami, review by David Allsopp)
• [#9712]: Update the version format to allow "`". The new format is
"major.minor[.patchlevel][(+|')additional-info]", for instance
"4.12.0~beta1+flambda". This is a documentation-only change for the
4.11 branch, the new format will be used starting with the 4.12
branch. (Florian Angeletti, review by Damien Doligez and Xavier
Leroy)
[#8644] https://github.com/ocaml/ocaml/issues/8644
[#9712] https://github.com/ocaml/ocaml/issues/9712
letters - simple client abstractions for sending emails over SMTP
═════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-letters-simple-client-abstractions-for-sending-emails-over-smtp/6071/1]
Miko announced
──────────────
Earlier today I've published the first release of [letters]. This
library aims to provide simple to use client library for sending
emails over SMTP using _lwt_ for async execution.
It is build on top of _mrmime_ and _colombe_. While these libraries
are very capable, they aren't that simple to use, _letters_ is trying
to fill that gap. Anyway, big thanks for the authors of these projects
for doing the heavy lifting.
As this library is still in its early stage, I believe I will break
the API with first few releases. Luckily the API is quite simple so
following these changes should be quite easy.
To make this library awesome, any feedback or feature request is
welcome. I'll try to address them as quickly as I can.
I hope I've managed to scratch someone else's itch too, enjoy.
[letters] https://github.com/oxidizing/letters
A question about Ocaml
══════════════════════
Archive: [https://discuss.ocaml.org/t/a-question-about-ocaml/6075/21]
Deep in this theard, Yawar Amin said
────────────────────────────────────
A few ReasonML books:
• [Web Development With ReasonML]
• [Exploring ReasonML] (free online)
• [Learn Type-Driven Development] (co-authored by me)
[Web Development With ReasonML] https://pragprog.com/titles/reasonml/
[Exploring ReasonML] http://reasonmlhub.com/exploring-reasonml/toc.html
[Learn Type-Driven Development]
https://www.packtpub.com/application-development/learn-type-driven-development
Alcotest 1.2.0
══════════════
Archive: [https://discuss.ocaml.org/t/ann-alcotest-1-2-0/6089/1]
Craig Ferguson announced
────────────────────────
I'm pleased to announce the release of [Alcotest] 1.2.0, now available
on Opam.
This release includes:
• a new `alcotest-mirage' package for running tests on MirageOS;
• full UTF-8 support;
• default coloured output in Dune (without needing to pass
`--no-buffer');
• an improved output format.
The full changelog is available [here].
[https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/a/ac89cfe4dfeed063560212136c9e2b690a888b6c.png]
Thanks to our many contributors in this release cycle.
[Alcotest] https://github.com/mirage/alcotest/
[here] https://github.com/mirage/alcotest/blob/1.2.0/CHANGES.md
Set up OCaml 1.1.0
══════════════════
Archive: [https://discuss.ocaml.org/t/ann-set-up-ocaml-1-1-0/6093/1]
Sora Morimoto announced
───────────────────────
This release contains these changes:
• The default opam repository can now be set via input.
• Linux VMs now use opam 2.0.7.
[https://github.com/avsm/setup-ocaml/releases/tag/v1.1.0]
Sora Morimoto then added
────────────────────────
In fact, this release was a long time ago, but I completely forgot to
post this. By the way, we have made significant improvements to some
of the documentation. In particular, the action versioning section is
applicable to other GitHub Actions and definitely worth reading!
[https://github.com/avsm/setup-ocaml#how-to-specify-the-version]
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2: Type: text/html, Size: 20500 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-07-07 10:04 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-07-07 10:04 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
[-- Attachment #2.1: Type: text/plain, Size: 25998 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of June 30 to July
07, 2020.
Table of Contents
─────────────────
Releases of ringo
Multicore OCaml: June 2020
Time expression demo
Interactive OCaml development with utop in Emacs
Old CWN
Releases of ringo
═════════════════
Archive: [https://discuss.ocaml.org/t/ann-releases-of-ringo/5605/5]
Continuing this thread, Raphaël Proust said
───────────────────────────────────────────
Ringo provides bounded-size key-value stores. More specifically, it
provides a functor similar to `Hastbl.Make' except that the number of
bindings held by the tables is limited: inserting additional bindings
when the limit has been reached causes some previously inserted
binding to be removed.
More more specifically, Ringo provides a function `map_maker' that
takes parameters to customise the policies that determine the
behaviour of the cache when supernumerary bindings are inserted, and
returns the functor described above. Once a module `Cache' is
instantiated using this functor, it can be used as follows:
┌────
│ let cache = Cache.create size
│ let fetch_data uri =
│ match Cache.find_opt cache uri with
│ | Some data -> data
│ | None ->
│ let data = really_fetch_data uri in
│ Cache.replace cache uri data;
│ data
└────
The cache will only hold up to [size] bindings, which avoids leaking
memory. Additionally, the parameters for `map_maker' allow you to
customise:
• The replacement policy: which binding is removed when a
supernumerary is inserted (currently supports least-recently used
and first-in first-out).
• The overflow policy: whether the cache can weakly hold some
supernumerary elements (if so, the cache may hold more but the GC
can always collect them if space is lacking).
• The accounting precision: whether to keep precise track of
removed/replaced elements.
In addition, Ringo also provide set-caches: i.e., sets (rather than
maps) with bounded size and all the same properties as above.
Also note Ringo-Lwt (`ringo-lwt') provides Lwt wrappers around Ringo
caches.
If you have suggestions for a different concise synopsis for `opam',
feel free to send them this way.
Use cases are, I guess, caches. In particular those that might receive
many elements not all of which you can hold in memory. We use it in a
few places in the Tezos project to hold resources (blocks, operations,
etc.) that are fetched from the P2p layer: it avoids having to fetch
them again from the network.
I think `anycache', `lru', and `lru-cache' are all alternatives
available on opam.
Raphaël Proust later added
──────────────────────────
The documentation is now available online at
[https://nomadic-labs.gitlab.io/ringo/index.html]
Of particular interest:
• [The signature for a `ringo' key-value cache]
• [The entry point for the `ringo' library] (allowing you to
instantiate modules with the above signature as well as simple value
caches)
• [The signature for `ringo-lwt' cache]
[The signature for a `ringo' key-value cache]
https://nomadic-labs.gitlab.io/ringo/ringo/Ringo/module-type-CACHE_MAP/index.html
[The entry point for the `ringo' library]
https://nomadic-labs.gitlab.io/ringo/ringo/Ringo/index.html
[The signature for `ringo-lwt' cache]
https://nomadic-labs.gitlab.io/ringo/ringo-lwt/Ringo_lwt/Sigs/module-type-CACHE_MAP/index.html
Multicore OCaml: June 2020
══════════════════════════
Archive:
[https://discuss.ocaml.org/t/multicore-ocaml-june-2020/6047/1]
Anil Madhavapeddy announced
───────────────────────────
Welcome to the June 2020 [Multicore OCaml] report! As with [previous
updates], many thanks to @shakthimaan and @kayceesrk for collating the
updates for the month of June 2020. /This is an incremental update;
new readers may find it helpful to flick through the previous posts
first./
This month has seen a tremendous surge of activity on the upstream
OCaml project to prepare for multicore integration, as @xavierleroy
and the core team have driven a number of initiatives to prepare the
OCaml project for the full multicore featureset. To reflect this,
from next month we will have a status page on the ocaml-multicore wiki
with the current status of both our multicore branch and the upstream
OCaml project itself.
Why not from this month? Well, there's good news and bad news. [Last
month], I observed that we are a PR away from most of the opam
ecosystem working with the multicore branch. The good news is that we
are still a single PR away from it working, but it's a different one
:-) The retrofitting of the `Threads' library has brought up [some
design complexities], and so rather than putting in a "bandaid" fix,
we are integrating a comprehensive solution that will work with system
threads, domains and (eventually) fibres. That work has taken some
time to get right, and I hope to be able to update you all on an
opam-friendly OCaml 4.10.0+multicore in a few weeks.
Aside from this, there have been a number of other improvements going
into the multicore branches: [mingw Windows support], [callstack
improvements], [fixing the Unix module] and so on. The full list is in
the detailed report later in this update.
[Multicore OCaml] https://github.com/ocaml-multicore/ocaml-multicore
[previous updates] https://discuss.ocaml.org/tag/multicore-monthly
[Last month]
https://discuss.ocaml.org/t/multicore-ocaml-may-2020-update/5898
[some design complexities]
https://github.com/ocaml-multicore/ocaml-multicore/pull/342
[mingw Windows support]
https://github.com/ocaml-multicore/ocaml-multicore/pull/351
[callstack improvements]
https://github.com/ocaml-multicore/ocaml-multicore/pull/363
[fixing the Unix module]
https://github.com/ocaml-multicore/ocaml-multicore/pull/346
Sandmark benchmarks
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
A major milestone in this month has been the upgrade to the latest
dune.2.6.0 to build Multicore OCaml 4.10.0 for the Sandmark
benchmarking project. A number of new OPAM packages have been added,
and the existing packages have been upgraded to their latest
versions. The Multicore OCaml code base has seen continuous
performance improvements and enhancements which can be observed from
the various PRs mentioned in the report.
We would like to thank:
• @xavierleroy for working on a number of multicore-prequisite PRs to
make stock OCaml ready for Multicore OCaml.
• @camlspotter has reviewed and accepted the camlimages changes and
made a release of camlimages.5.0.3 required for Sandmark.
• @dinosaure for updating the decompress test benchmarks for Sandmark
to build and run with dune.2.6.0 for Multicore OCaml 4.10.0.
A chapter on Parallel Programming in Multicore OCaml with topics on
task pool, channels section, profiling with code examples is being
written. We shall provide an early draft version of the document to
the community for your valuable feedback.
Papers
╌╌╌╌╌╌
Our "Retrofitting Parallism onto OCaml" paper has been officially
accepted at [ICFP 2020] which will be held virtually between August
23-28, 2020. A [preprint] of the paper was made available earlier, and
will be updated in a few days with the camera-ready version for ICFP.
Please do feel free to send on comments and queries even after the
paper is published, of course.
Excitingly, another multicore-related paper on [Cosmo: A Concurrent
Separation Logic for Multicore OCaml] will also be presented at the
same conference.
The Multicore OCaml updates are first listed in our report, which are
followed by improvements to the Sandmark benchmarking
project. Finally, the changes made to upstream OCaml which include
both the ongoing and completed tasks are mentioned for your reference.
[ICFP 2020]
https://icfp20.sigplan.org/track/icfp-2020-papers#event-overview
[preprint] https://arxiv.org/abs/2004.11663
[Cosmo: A Concurrent Separation Logic for Multicore OCaml]
http://gallium.inria.fr/~fpottier/publis/mevel-jourdan-pottier-cosmo-2020.pdf
Multicore OCaml
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
◊ Ongoing
• [ocaml-multicore/ocaml-multicore#339] Proposal for domain-local
storage
An RFC proposal to implement a domain-local storage in Multicore
OCaml. Kindly review the idea and share your feedback!
• [ocaml-multicore/ocaml-multicore#342] Implementing the threads
library with Domains
An effort to rebase @jhwoodyatt's implementation of the Thread
library for Domains.
• [ocaml-multicore/ocaml-multicore#357] Implementation of systhreads
with pthreads
Exploring the possibilty of implementing systhreads with pthreads,
while still maintaining compatibility with the existing solution.
• [ocaml/dune#3548] Dune fails to pick up secondary compiler
The `ocaml-secondary-compiler' fails to install with
dune.2.6.0. This is required as Multicore OCaml cannot build the
latest dune without systhreads support.
[ocaml-multicore/ocaml-multicore#339]
https://github.com/ocaml-multicore/ocaml-multicore/issues/339
[ocaml-multicore/ocaml-multicore#342]
https://github.com/ocaml-multicore/ocaml-multicore/pull/342
[ocaml-multicore/ocaml-multicore#357]
https://github.com/ocaml-multicore/ocaml-multicore/issues/357
[ocaml/dune#3548] https://github.com/ocaml/dune/issues/3548
◊ Completed
• [ocaml-multicore/multicore-opam#22] Update dune to 2.6.0
The dune version in the Multicore OPAM repository is now updated to
use the latest 2.6.0.
• [ocaml-multicore/ocaml-multicore#338] Introduce Lazy.try_force and
Lazy.try_force_val
An implementation of `Lazy.try_force' and `Lazy.try_force_val'
functions to implement concurrent lazy abstractions.
• [ocaml-multicore/ocaml-multicore#340] Fix Atomic.exchange in
concurrent_minor_gc
A patch that introduces `Atomic.exchange' through `Atomic.get' that
provides the appropriate read barrier for correct exchange semantics
for `caml_atomic_exchange' in `memory.c'.
• [ocaml-multicore/ocaml-multicore#343] Fix extcall noalloc DWARF
The DWARF information emitted for `extcall noalloc' had broken
backtraces and this PR fixes the same.
• [ocaml-multicore/ocaml-multicore#345] Absolute exception stack
The representation of the exception stack is changed from relative
addressing to absolute addressing and the results are promising. The
Sandmark serial benchmark results after the change is illustrated in
the following graph:
[https://aws1.discourse-cdn.com/standard11/uploads/ocaml/optimized/2X/b/b385409b3f9e44cbfef98de668b0b4d0ed403472_2_1380x436.png]
• [ocaml-multicore/ocaml-multicore#347] Turn on -Werror by default
Adds a `--enable-warn-error' option to `configure' to treat C
compiler warnings as errors.
• [ocaml-multicore/ocaml-multicore#353] Poll for interrupts in
cpu_relax without locking
Use `Caml_check_gc_interrupt' first to poll for interrupts without
locking, and then proceeding to handle the interrupt with the lock.
• [ocaml-multicore/ocaml-multicore#354] Add Caml_state_field to
domain_state.h
The `Caml_state_field' macro definition in domain_state.h is
required for base-v0.14.0 to build for Multicore OCaml 4.10.0 with
dune.2.6.0.
• [ocaml-multicore/ocaml-multicore#355] One more location to poll for
interrupts without lock
Another use of `Caml_check_gc_interrupt' first to poll for
interrupts without lock, similar to
[ocaml-multicore/ocaml-multicore#353].
• [ocaml-multicore/ocaml-multicore#356] Backup threads for domain
Introduces `backup threads' to perform GC and handle service
interrupts when the domain is blocked in the kernel.
• [ocaml-multicore/ocaml-multicore#358] Fix up bad CFI information in
amd64.S
Add missing `CFI_ADJUST' directives in `runtime/amd64.S' for
`caml_call_poll' and `caml_allocN'.
• [ocaml-multicore/ocaml-multicore#359] Inline caml_domain_alone
The PR makes `caml_domain_alone' an inline function to improve
performance for `caml_atomic_cas_field' and other atomics in
`memory.c'.
• [ocaml-multicore/ocaml-multicore#360] Parallel minor GC inline mask
rework
The inline mask rework for the promotion path to the
`parallel_minor_gc' branch gives a 3-5% performance improvement for
`test_decompress' sandmark benchmark, and a decrease in the executed
instructions for all other benchmarks.
• [ocaml-multicore/ocaml-multicore#361] Mark stack push work credit
The PR improves the Multicore mark work accounting to be in line
with stock OCaml.
• [ocaml-multicore/ocaml-multicore#362] Iloadmut does not clobber rax
and rdx when we do not have a read barrier
A code clean-up to free the registers `rax' and `rdx' for OCaml code
when `Iloadmut' is used.
[ocaml-multicore/multicore-opam#22]
https://github.com/ocaml-multicore/multicore-opam/pull/22
[ocaml-multicore/ocaml-multicore#338]
https://github.com/ocaml-multicore/ocaml-multicore/pull/338
[ocaml-multicore/ocaml-multicore#340]
https://github.com/ocaml-multicore/ocaml-multicore/pull/340
[ocaml-multicore/ocaml-multicore#343]
https://github.com/ocaml-multicore/ocaml-multicore/pull/343
[ocaml-multicore/ocaml-multicore#345]
https://github.com/ocaml-multicore/ocaml-multicore/pull/345
[ocaml-multicore/ocaml-multicore#347]
https://github.com/ocaml-multicore/ocaml-multicore/pull/347
[ocaml-multicore/ocaml-multicore#353]
https://github.com/ocaml-multicore/ocaml-multicore/pull/353
[ocaml-multicore/ocaml-multicore#354]
https://github.com/ocaml-multicore/ocaml-multicore/pull/354
[ocaml-multicore/ocaml-multicore#355]
https://github.com/ocaml-multicore/ocaml-multicore/pull/355
[ocaml-multicore/ocaml-multicore#356]
https://github.com/ocaml-multicore/ocaml-multicore/pull/356
[ocaml-multicore/ocaml-multicore#358]
https://github.com/ocaml-multicore/ocaml-multicore/pull/358
[ocaml-multicore/ocaml-multicore#359]
https://github.com/ocaml-multicore/ocaml-multicore/pull/359
[ocaml-multicore/ocaml-multicore#360]
https://github.com/ocaml-multicore/ocaml-multicore/pull/360
[ocaml-multicore/ocaml-multicore#361]
https://github.com/ocaml-multicore/ocaml-multicore/pull/361
[ocaml-multicore/ocaml-multicore#362]
https://github.com/ocaml-multicore/ocaml-multicore/pull/362
Benchmarking
╌╌╌╌╌╌╌╌╌╌╌╌
◊ Ongoing
• [ocaml-bench/sandmark#8] Ability to run compiler variants in
Sandmark
A feature to specify configure options when building compiler
variants such as `flambda' is useful for development and
testing. This feature is being worked upon.
• [ocaml-bench/sandmark#107] Add Coq benchmarks
We are continuing to add more benchmarks to Sandmark for Multicore
OCaml and investigating adding the [Coq] benchmarks to our
repertoire!
• [ocaml-bench/sandmark#124] User configurable paramwrapper added to
Makefile
A `PARAMWRAPPER' environment variable can be passed as an argument
by specifying the `--cpu-list' to be used for parallel benchmark
runs.
• [ocaml-bench/sandmark#131] Update decompress benchmarks
Thanks to @dinosaure for updating the decompress benchmarks in order
to run them with dune.2.6.0 for Multicore OCaml 4.10.0.
• [ocaml-bench/sandmark#132] Update dependency packages to use
dune.2.6.0 and Multicore OCaml 4.10.0
Sandmark has been running with dune.1.11.4, and we need to move to
the latest dune.2.6.0 for using Multicore OCaml 4.10.0 and beyond,
as mentioned in [Promote dune to > 2.0]. The PR updates over 30
dependency packages and successfully builds both serial and parallel
benchmarks!
[ocaml-bench/sandmark#8]
https://github.com/ocaml-bench/sandmark/issues/8
[ocaml-bench/sandmark#107]
https://github.com/ocaml-bench/sandmark/issues/107
[Coq] https://coq.inria.fr/
[ocaml-bench/sandmark#124]
https://github.com/ocaml-bench/sandmark/pull/124
[ocaml-bench/sandmark#131]
https://github.com/ocaml-bench/sandmark/pull/131
[ocaml-bench/sandmark#132]
https://github.com/ocaml-bench/sandmark/pull/132
[Promote dune to > 2.0]
https://github.com/ocaml-bench/sandmark/issues/106
◊ Completed
• [camlspotter/camlimages#1] Use dune-configurator instead of
configurator for camlimages
A new release of `camlimages.5.0.3' was made by @camlspotter after
accepting the changes to camlimages.opam in order to build with
dune.2.6.0.
• [ocaml-bench/sandmark#115] Task API Port: LU-Decomposition, Floyd
Warshall, Mandelbrot, Nbody
The changes to use the `Domainslib.Task' API for the listed
benchmarks have been merged.
• [ocaml-bench/sandmark#121] Mention sudo access for
run_all_parallel.sh script
The README.md file has been updated with the necessary `sudo'
configuration steps to execute the `run_all_parallel.sh' script for
nightly builds.
• [ocaml-bench/sandmark#125] Add cubicle benchmarks
The `German PFS' and `Szymanski's mutual exclusion algorithm'
cubicle benchmarks have been included in Sandmark.
• [ocaml-bench/sandmark#126] Update ocaml-versions README to reflect
4.10.0+multicore
The README has now been updated to reflect the latest 4.10.0
Multicore OCaml compiler and its variants.
• [ocaml-bench/sandmark#129] Add target to run parallel benchmarks in
the CI
The .drone.yml file used by the CI has been updated to run both the
serial and parallel benchmarks.
• [ocaml-bench/sandmark#130] Add missing dependencies in
multicore-numerical
The `domainslib' library has been added to the dune file for the
multicore-numerical benchmark.
[camlspotter/camlimages#1]
https://gitlab.com/camlspotter/camlimages/-/merge_requests/1
[ocaml-bench/sandmark#115]
https://github.com/ocaml-bench/sandmark/pull/115
[ocaml-bench/sandmark#121]
https://github.com/ocaml-bench/sandmark/pull/121
[ocaml-bench/sandmark#125]
https://github.com/ocaml-bench/sandmark/pull/125
[ocaml-bench/sandmark#126]
https://github.com/ocaml-bench/sandmark/pull/126
[ocaml-bench/sandmark#129]
https://github.com/ocaml-bench/sandmark/pull/129
[ocaml-bench/sandmark#130]
https://github.com/ocaml-bench/sandmark/pull/130
OCaml
╌╌╌╌╌
◊ Ongoing
• [ocaml/ocaml#9541] Add manual page for the instrumented runtime
The [instrumented runtime] has been merged to OCaml 4.11.0. A manual
for the same has been created and is under review.
• [sadigqj/ocaml#1] GC colours change
This PR removes the grey colour used in stock OCaml to match the
scheme used by the Multicore major collector. The performance and
considerations are included for review.
[ocaml/ocaml#9541] https://github.com/ocaml/ocaml/pull/9541
[instrumented runtime] https://github.com/ocaml/ocaml/pull/9082
[sadigqj/ocaml#1] https://github.com/sadiqj/ocaml/pull/1
◊ Completed
• [ocaml/ocaml#9619] A self-describing representation for function
closures
The PR provides a way to record the position of the environment for
each entry point for function closures.
• [ocaml/ocaml#9649] Marshaling for the new closure representation
The `output_value' marshaler has been updated to use the new closure
representation. There is no change required for the `input_value'
unmarshaler.
• [ocaml/ocaml#9655] Introduce type Obj.raw_data and functions
Obj.raw_field, Obj.set_raw_field to manipulate out-of-heap pointers
The PR introduces a type `Obj.bits', and functions `Obj.field_bits'
and `Obj.set_field_bits' to read and write bit representation of
block fields to support the no-naked-pointer operation.
• [ocaml/ocaml#9678] Reimplement Obj.reachable_word using a hash table
to detect sharing
The `caml_obj_reachable_words' now uses a hash table instead of
modifying the mark bits of block headers to detect sharing. This is
required for compatibility with Multicore OCaml.
• [ocaml/ocaml#9680] Naked pointers and the bytecode interpreter
The bytecode interpreter implementation is updated to support the
no-naked-pointers mode operation as required by Multicore OCaml.
• [ocaml/ocaml#9682] Signal handling in native code without the page
table
The patch uses the code fragment table instead of a page table
lookup for signal handlers to know whether the signal came from
ocamlopt-generated code.
• [ocaml/ocaml#9683] globroots.c: adapt to no-naked-pointers mode
The patch considers out-of-heap pointers as major-heap pointers in
no-naked-pointers mode for global roots management.
• [ocaml/ocaml#9689] Generic hashing for the new closure
representation
The hashing functions have been updated to use the latest closure
representation from [ocaml/ocaml#9619] for the no-naked-pointers
mode.
• [ocaml/ocaml#9698] The end of the page table is near
The PR eliminates some of the use of the page tables in the runtime
system when built with no-naked-pointers mode.
Our thanks to all the OCaml developers and users in the community for
their continued support and contribution to the project. Stay safe!
[ocaml/ocaml#9619] https://github.com/ocaml/ocaml/pull/9619
[ocaml/ocaml#9649] https://github.com/ocaml/ocaml/pull/9649
[ocaml/ocaml#9655] https://github.com/ocaml/ocaml/pull/9655
[ocaml/ocaml#9678] https://github.com/ocaml/ocaml/pull/9678
[ocaml/ocaml#9680] https://github.com/ocaml/ocaml/pull/9680
[ocaml/ocaml#9682] https://github.com/ocaml/ocaml/pull/9682
[ocaml/ocaml#9683] https://github.com/ocaml/ocaml/pull/9683
[ocaml/ocaml#9689] https://github.com/ocaml/ocaml/pull/9689
[ocaml/ocaml#9698] https://github.com/ocaml/ocaml/pull/9698
Acronyms
╌╌╌╌╌╌╌╌
• API: Application Programming Interface
• CFI: Call Frame Information
• CI: Continuous Integration
• DWARF: Debugging With Attributed Record Formats
• GC: Garbage Collector
• ICFP: International Conference on Functional Programming
• OPAM: OCaml Package Manager
• PR: Pull Request
• RFC: Request for Comments
Time expression demo
════════════════════
Archive: [https://discuss.ocaml.org/t/time-expression-demo/6052/1]
Darren announced
────────────────
An interactive demo for a small part of our time stuff and schedule
handling library is available here:
[https://daypack-dev.github.io/time-expr-demo/]
Time expression is in essence a language for specifying time points or
time slots precisely and concisely, while trying to mimic natural
language.
The implementation of the demo core itself can be seen here:
[https://github.com/daypack-dev/time-expr-demo/blob/master/src/demo.ml]
, where the usage of Daypack-lib is shown.
Lastly, the library is still a prototype, so expect some faults in the
outputs of the demo here and there.
Interactive OCaml development with utop in Emacs
════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/interactive-ocaml-development-with-utop-in-emacs/6058/1]
Samarth Kishor announced
────────────────────────
I made a [blog post] about REPL driven development with utop in Emacs
a few months ago. Please let me know if you found it useful or have
anything to add! I'm a bit new to OCaml so any feedback helps.
There was a [similar post about REPL driven development] last year and
my post addresses a lot of those points. I wish I'd seen that post
before I wrote this since there's a ton of useful information in the
comments.
[blog post]
https://samarthkishor.github.io/posts/interactive_ocaml_development/
[similar post about REPL driven development]
https://discuss.ocaml.org/t/ocaml-repl-driven-development/4068
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2.2: Type: text/html, Size: 39647 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-06-30 7:00 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-06-30 7:00 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
[-- Attachment #2.1: Type: text/plain, Size: 7753 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of June 23 to 30,
2020.
Table of Contents
─────────────────
finch - static site generator
ANN: Releases of ringo
OCaml 4.11, first beta release
FlexDLL 0.38 released
Other OCaml News
Old CWN
finch - static site generator
═════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-finch-static-site-generator/6026/1]
roddy announced
───────────────
Announcing [finch], a simple static site generator. It uses content
written as Markdown plus YAML frontmatter like Jekyll/Hugo etc. and
produces output with [Jingoo] templates. It also has some integrations
with React (as in the JS library) in the form of Jingoo filters: the
motivation behind it was to make it easier to develop sites that use
React just for some in some parts rather than structuring the whole
site as a single page application.
[finch] https://github.com/roddyyaga/finch
[Jingoo] https://github.com/tategakibunko/jingoo
ANN: Releases of ringo
══════════════════════
Archive: [https://discuss.ocaml.org/t/ann-releases-of-ringo/5605/3]
Raphaël Proust announced
────────────────────────
Version 0.5 of `ringo' and `ringo-lwt' are now available in
`opam'. Although this version changes `ringo-lwt' only, both packages
are released anew to keep the version numbers in sync. This version
includes:
• Improvement in documentation.
• Simplifications and reduction in the memory footprint of lwt-wrapped
caches.
• Fix for a race condition in the automatic cleanup (previously, on
weak caches only, a promise being rejected could cause a different
promise to be removed from the cache)
• Fix a leak
• More test, including a test for leakiness.
OCaml 4.11, first beta release
══════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-4-11-first-beta-release/6042/1]
octachron announced
───────────────────
The release of OCaml 4.11.0 is approaching.
After three alpha releases, we have created a first beta version to
help you adapt your software to the new features ahead of the release.
The compatibility of the opam ecosystem with OCaml 4.11.0 is currently
quite good, and it should be possible to test this beta without too
much trouble.
The source code is available at these addresses:
[https://github.com/ocaml/ocaml/archive/4.11.0+beta1.tar.gz]
[https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-4.11.0+beta1.tar.gz]
The compiler can also be installed as an OPAM switch with one of the
following commands.
┌────
│ opam switch create ocaml-variants.4.11.0+beta1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
or
┌────
│ opam switch create ocaml-variants.4.11.0+beta1+VARIANT --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where you replace VARIANT with one of these: afl, flambda, fp,
fp+flambda
We want to know about all bugs. Please report them here:
[https://github.com/ocaml/ocaml/issues]
If you are interested by the list of new features, and the on-going
list of bug fixes the updated change log for OCaml 4.11.0 is available
at:
[https://github.com/ocaml/ocaml/blob/4.11/Changes]
Compared to the last alpha release, this first beta release contains
the following new bug fixes:
Driver
╌╌╌╌╌╌
• [#9011]: Allow linking .cmxa files with no units on MSVC by not
requiring the .lib file to be present. (David Allsopp, report by
Dimitry Bely, review by Xavier Leroy)
[#9011] https://github.com/ocaml/ocaml/issues/9011
Typechecker
╌╌╌╌╌╌╌╌╌╌╌
• [#9384], [#9385]: Fix copy scope bugs in substitutions (Leo White,
review by Thomas Refis, report by Nick Roberts)
• [#9695], [#9702]: no error when opening an alias to a missing module
(Jacques Garrigue, report and review by Gabriel Scherer)
[#9384] https://github.com/ocaml/ocaml/issues/9384
[#9385] https://github.com/ocaml/ocaml/issues/9385
[#9695] https://github.com/ocaml/ocaml/issues/9695
[#9702] https://github.com/ocaml/ocaml/issues/9702
Warnings
╌╌╌╌╌╌╌╌
• [#7897], [#9537]: Fix warning 38 for rebound extension constructors
(Leo White, review by Florian Angeletti)
• [#9244]: Fix some missing usage warnings (Leo White, review by
Florian Angeletti)
[#7897] https://github.com/ocaml/ocaml/issues/7897
[#9537] https://github.com/ocaml/ocaml/issues/9537
[#9244] https://github.com/ocaml/ocaml/issues/9244
Toplevel
╌╌╌╌╌╌╌╌
• [#9415]: Treat `open struct' as `include struct' in toplevel (Leo
White, review by Thomas Refis)
• [#9416]: Avoid warning 58 in flambda ocamlnat (Leo White, review by
Florian Angeletti)
[#9415] https://github.com/ocaml/ocaml/issues/9415
[#9416] https://github.com/ocaml/ocaml/issues/9416
Flambda backend
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• [#9163]: Treat loops properly in un_anf (Leo White, review by Mark
Shinwell, Pierre Chambart and Vincent Laviron)
[#9163] https://github.com/ocaml/ocaml/issues/9163
FlexDLL 0.38 released
═════════════════════
Archive: [https://discuss.ocaml.org/t/flexdll-0-38-released/6043/1]
David Allsopp announced
───────────────────────
We are pleased to announce the release of FlexDLL 0.38!
FlexDLL provides a dlopen-like interface for Windows and is used to
simplify the linking process for the native Windows ports of OCaml and
to allow dynamic loading of C code (bytecode stub libraries and native
Dynlink). It is also used for the same purpose in the Cygwin ports of
OCaml, except that they can be configured without shared library
support.
The release includes various bugfixes as well as proper support for
C++ linking on mingw and linking against data symbols in import
libraries.
Please see the [release page] for more information.
[release page] https://github.com/alainfrisch/flexdll/releases/tag/0.38
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Frama-C 21.1 (Scandium) is out. Download it here.]
[OCaml Planet] http://ocaml.org/community/planet/
[Frama-C 21.1 (Scandium) is out. Download it here.]
http://frama-c.com/index.html
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2.2: Type: text/html, Size: 20340 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-06-16 8:36 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-06-16 8:36 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
[-- Attachment #2.1: Type: text/plain, Size: 12607 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of June 09 to 16,
2020.
Table of Contents
─────────────────
First release of monolith
Sylvain Conchon joined OCamlPro's team
First release of streaming
Senior software engineer at Asemio in Tulsa, OK
Other OCaml News
Old CWN
First release of monolith
═════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-first-release-of-monolith/5946/1]
François Pottier announced
──────────────────────────
It is my pleasure to announce the first release of Monolith.
Monolith offers facilities for testing an OCaml library (for instance,
a data structure implementation) by comparing it against a reference
implementation. It uses a form of black-box testing, and relies on
`afl-fuzz' for efficiency.
The user must describe what types and operations the library
provides. Under the best circumstances, this requires 2-3 lines of
code per type or operation. The user must also provide a reference
implementation of the library.
Then, like a monkey typing on a keyboard, Monolith attempts to
exercise the library in every possible way, in the hope of discovering
a scenario where the library behaves incorrectly. If such a scenario
is discovered, it is printed in the form of an OCaml program, so as to
help the user reproduce the problem.
At this time, a tutorial is not yet available. There is however an API
documentation and a number of demos.
Repository: [https://gitlab.inria.fr/fpottier/monolith]
API Documentation:
[http://cambium.inria.fr/~fpottier/monolith/doc/monolith/Monolith/index.html]
Installation:
┌────
│ opam update
│ opam install monolith
└────
Sylvain Conchon joined OCamlPro's team
══════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/sylvain-conchon-joined-ocamlpros-team/5956/1]
OCamlPro announced
──────────────────
Sylvain Conchon joined OCamlPro's team as Formal Methods CSO. He
created Alt-Ergo and has been teaching OCaml in universities for about
20 years. He shares thoughts on interactions between industry and
research labs, and his vision of Formal methods and OCaml as language
for the industry. Read his interview on our blog:
[https://www.ocamlpro.com/2020/06/05/interview-sylvain-conchon-cso-on-formal-methods/]
First release of streaming
══════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-first-release-of-streaming/5961/1]
Rizo announced
──────────────
It is my pleasure to announce the first public release of `streaming'
– a library for building efficient, incremental data processing
pipelines that compose and don't leak resources.
I built streaming as a result of many experiments with different
streaming and iteration models for OCaml. There are multiple packages
on OPAM that share some of the goals of `streaming' (we even have
`Stdlib.Seq' now!), but none of them combine (1) excellent
performance, (2) safe resource handling and (3) pure functional style
for combinators. Streaming solves these problems by implementing
three basic and independent models: _sources_, _sinks_ and _flows_ –
they represents different parts of the pipeline that correspond to
producing, consuming and transforming elements. These models can be
defined and composed independently to produce reusable "streaming
blocks".
The library defines a central `Stream' model that relies on sources,
sinks and flows. This model is a push-based iterator with performance
characteristics similar to the `iter' iterator, which has type `('a ->
unit) -> unit', and is known for being very efficient. But unlike
`iter', it has a pure functional core (no need to use mutable state
and exceptions for flow control!) and can handle resource allocation
and clean up in a lazy and deterministic way. All of this while having
a slightly better performance for common stream operations.
For those who are curious about the performance characteristics of
`streaming' and other models, I created a dedicated repository for
stream benchmarks: [https://github.com/rizo/streams-bench]. In
particular, it includes a few simple benchmarks for `Gen',
`Base.Sequence', `Stdlib.Seq', `Iter', `Streaming.Stream' and
`Streaming.Source'.
The library should soon be published on opam. In the meantime, I
invite you to read the docs and explore the code:
• Library documentation: [https://odis-labs.github.io/streaming]
• Github project: [https://github.com/odis-labs/streaming]
Guillaume Bury askec
────────────────────
That's great ! From the benchmarks, it looks like you hit a really
good implementation !
I've looked (maybe a bit fast) at the API documentation, and it is
admittedly a bit outside the scope of streams/iterators, but I was
wondering if there was some proper way to:
• connect a sink to a source to create some loop
• have some kind of fixpoint on streams
I guess it would always be possible to use some references and/or some
complex functions to encode these into the provided API, but I was
wondering if there was a clean way to do it.
For a bit of context and explanation, what I have in mind is the case
of a program (let's say a type-checker or something close to the idea)
with a *persistent state*, that should operate over a stream of
inputs, which are top-level phrases, and produce some outputs, for
instance print some result for each correctly type-checked statement
(and an error otherwise). The type-checker would basically be a
function of type `(`input * `state) -> (`output * `state)', and
starting from an initial state, it would process an input element
(giving the output to some sink), and then the next input element
would be processed with the state that was reached after processing
the previous element: the state would reach the sink of the flow, and
then be inserted back into the source. Separately, imagine the
language being type-checked has a notion of include, then one of the
step of the flow would be to expand each include into a stream of
inputs/phrases, but each of the phrases in this stream would need to
be expanded, so a simple `flat_map~/~flatten' is not enough.
I already have a custom implementation that handle these features, but
I was wondering whether I could use `streaming' to handle most of the
code linking all of the steps, ^^
Rizo replied
────────────
if there was some proper way to:
• connect a sink to a source to create some loop
• have some kind of fixpoint on streams
Regarding the first point: yes! That's exactly the point of the
`Stream' module. You see, sources are pull-based abstractions, while
sinks are push-based. Source's type essentially says something like
_"I might give you some data, if you ask"_, while sink's type is the
opposite _"I might take some data, if you give it to me"_. They are
completely and intentionally decoupled; it is Stream's role to drive
the computation by pulling data from sources and pushing it into
sinks. So the easiest way to connect them is:
┌────
│ Stream.(from srouce |> into sink)
└────
Of course, that's not very useful per se, but it illustrates my
point. Take a look at the [`Stream.from'] code to see the
implementation of the loop you're asking for. It does some extra work
to ensure that resources are correctly handled, but it should be clear
what the loop is doing.
The stream types in the library are currently abstract because I
didn't want to commit to a particular representation just yet. If this
is a problem for your use case, let me know, I'll expose them in a
`Private' module.
Regarding the second point: I'm not sure what you mean in practice by
"fixpoint on streams". I guess the one thing that could help implement
something like that is the [`Stream.run'] function. It allows you to
continue reading elements from a source even after a sink is filled by
returning a leftover stream. This stream can be used with
`Stream.run' repeatedly.
Alternatively there's also [`Flow.through'], which consumes input
trying to fill sinks repeatedly and produces their aggregated values
as a stream. Super useful for things like streaming parsing. Might
even help with your use-case for top-level phrases.
On a more general note though, the type `('input * 'state) -> ('output
* 'state)' looks a lot like a [mealy machine]. `Streaming.Sink' is a
[moore machine], which is slightly less general because the output
values do not depend on input values, only on the state.
I thought about exposing different kinds of sinks in streaming, but
wanted to make sure that the common use cases are covered first. I'll
keep your case in mind for future versions of the library.
[`Stream.from']
https://github.com/odis-labs/streaming/blob/0.8.0/lib/Stream.ml#L42
[`Stream.run']
https://odis-labs.github.io/streaming/streaming/Streaming/Stream/index.html#val-run
[`Flow.through']
https://odis-labs.github.io/streaming/streaming/Streaming/Flow/index.html#val-through
[mealy machine] https://en.wikipedia.org/wiki/Mealy_machine
[moore machine] https://en.wikipedia.org/wiki/Moore_machine
Senior software engineer at Asemio in Tulsa, OK
═══════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/senior-software-engineer-at-asemio-in-tulsa-ok/5979/1]
Simon Grondin announced
───────────────────────
We are Asemio and our team of data scientists, software engineers,
architects, and management consultants are working together to achieve
a nationwide data ecosystem for social good.
You’ll be working on the Asemio Community Integration Platform. It
features state-of-the-art privacy-preserving, pre-processing and
pipeline management, as well as record linkage technology.
The back end is written in OCaml. The front end is compiled from OCaml
to JavaScript and uses a modern MVC framework. The work you’ll be
doing will touch numerous technical disciplines, including
cryptography, distributed systems, language design and implementation,
data analytics, and data visualizations.
We prefer candidates willing to relocate, but we could make an
exception for an exceptional candidate.
For more information or to apply, please refer to our SE listing:
[https://stackoverflow.com/jobs/401383/ocaml-senior-software-engineer-asemio]
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Frama-C 21.0 (Scandium) is out. Download it here.]
• [Every proof assistant: Epigram 2 - Autopsy, Obituary, Apology]
[OCaml Planet] http://ocaml.org/community/planet/
[Frama-C 21.0 (Scandium) is out. Download it here.]
http://frama-c.com/index.html
[Every proof assistant: Epigram 2 - Autopsy, Obituary, Apology]
http://math.andrej.com/2020/06/09/epigram-2-autopsy-obituary-apology/
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2.2: Type: text/html, Size: 25107 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-06-09 8:28 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-06-09 8:28 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 28667 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of June 02 to 09,
2020.
Table of Contents
─────────────────
Multicore Update: April 2020, with a preprint paper
BAP 2.1.0 Release
Migrating an Async project to Lwt, a short primer
jose 0.4.0
OCaml 4.11.0, second alpha release
OCaml Workshop 2020: Call for Volunteers
Introduction to Lwt
Other OCaml News
Old CWN
Multicore Update: April 2020, with a preprint paper
═══════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/multicore-update-april-2020-with-a-preprint-paper/5630/26]
Continuing this thread, Daniel Bünzli asked and KC Sivaramakrishnan replied
───────────────────────────────────────────────────────────────────────────
One thing that I didn’t get from the paper is how exactly
`ConcurMinor' breaks the current FFI and the impact it
would have on the existing eco-system, on a scale from “it
affect all projects” to “only people doing *that* fancy
thing” :–) ?
All the projects that use the C API. The details are here:
[https://github.com/ocaml-multicore/ocaml-multicore/wiki/C-API-changes]
At the end of the paper it seems you make the point that
`ParMinor' is the solution to go with for the time
being. Does this means you are going to leave behind the
work done on `ConcurMinor' or do you intend to continue to
maintain it ?
We don't intend to maintain it. It is quite a bit of work to maintain
and port the changes across two different GCs. `ParMinor' GC is now
at 4.11 branch point (the default multicore compiler is 4.10 +
ParMinor now). The `ConcMinor' is at 4.06.1.
Given that `ConcMinor' breaks the C API, the ecosystem would have to
be fixed for `ConcMinor' to be useful. The code changes are indeed
intricate; the differences are not just in the minor GC, but the
compilers internal use of the C API. It will be quite a bit of work to
keep both GCs in the same source distribution.
Guillaume Munch-Maccagnoni then said
────────────────────────────────────
Given that `ConcMinor' breaks the C API, the ecosystem
would have to be fixed for `ConcMinor' to be useful.
I do not think this is necessarily true.
Here is why I think so, but be warned that this is preliminary as I do
not have time to explore this idea further on my own at the moment.
State in Rust
╌╌╌╌╌╌╌╌╌╌╌╌╌
Breaking the C API is a consequence of deciding that all
single-threaded shared mutable state must assume they are also shared
between threads. So a new read barrier is used to promote values when
read from another thread. But for data types that were correct up to
now, users must also be careful to avoid races from now on… for
instance by avoiding sharing values of such types between domains.
One lesson of Rust is that there are different kinds of mutable state,
for different usages, with different means to achieve thread-safety.
The closest there is to current OCaml's `mutable' is the notion of
single-threaded multiple-writers mutable state (_`Cell'_). It is made
thread-safe in Rust by statically preventing values containing `Cell'
from crossing thread boundaries (by virtue of not having the _`Send'
trait_). The same restriction is used to make some data structures
more efficient by avoiding the cost of synchronisation (cf. the
reference-counting pointer `Rc' vs. the atomic reference-counting
pointer `Arc').
This is not enough by itself, and Rust offers other kinds of state for
communicating and sharing values between threads.
_`UnsafeCell'_ like Ocaml multicore's `mutable' (though yours is safe
thanks to the work on the memory model): it has almost no restriction
and can be sent across domains, but the user is likewise told to
“avoid data races”. It is rarely used alone, but together with type
abstraction it can be used to program safe concurrent data structures.
Lastly, the default notion of state in Rust is linear state, which can
be sent freely across threads. Thread-safety is ensured by restricting
aliasing using the ownership and borrowing discipline.
A backwards-compatible concurrent collector?
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
If I had to imagine a backwards-compatible OCaml with static control
of interference à la Rust based on `ConcMinor', it would distinguish
the three kinds of state (concretely with other keywords in addition
to `mutable'). `mutable' would keep its current meaning of
single-domain, multiple-writers state and not require a read barrier,
and in particular preserve the API. (I count systhreads as
single-threaded for this purpose, since here it means "sharing the
same minor heap".)
Programs could progressively transition to other kinds of state when
parallelising the program. Concretely, a data structure like
`Stack.t', instead of becoming racy, would keep its current meaning,
but users could replace it with a linear stack or a concurrent stack,
two data structures distinct from the first one, when parallelizing
their programs.
So how could this fit with the current plans? It is not entirely clear
to me. If people start to rely on parallelism in an unstructured way
(e.g. no clear distinction between different kinds of data types
arising from different ways of ensuring thread-safety) then one will
also lose the ability to retrofit `ConcMinor' in a
backwards-compatible manner (by losing the information that the
current `mutable' API is single-threaded). The API breakage of
`ConcMinor' which might only be virtual right now (if I trust this
preliminary, not fully-explored idea) will become real. (Further
difficulties arise with the emulation of the `Thread' library with
domains, but this could be changed later.)
But if users are provided in advance with a general direction for a
model of control of interference this might happen differently. And
eventually having such a model is desirable in any case, as it helps
parallelizing programs (for instance the Firefox people reported that
they had attempted and failed twice to parallelise the CSS engine in
C++ before succeeding with Rust). Furthermore, in an imaginary
retrofitting of `ConcMinor', one could imagine enforcing something
like the `Send' trait at the level of the read barrier until there is
a better way (there would be two kinds of barriers, one of which would
raise an exception if a state happened to be incorrectly shared across
domains, and not be required in the FFI).
I find `ConcMinor' interesting from a systems programming perspective
compared to the stop-the-world collector because it could (I hope)
offer possibilities such as having a low-latency domain communicating
with a higher-latency domain. Moreover the performance cost of the
read barrier might be lower in this scheme if it could be removed for
all but the concurrent data structures.
BAP 2.1.0 Release
═════════════════
Archive: [https://discuss.ocaml.org/t/ann-bap-2-1-0-release/5906/1]
Ivan Gotovchits announced
─────────────────────────
The Carnegie Mellon University Binary Analysis Platform ([CMU BAP]) is
a suite of utilities and libraries that enables analysis of programs
that are represented as machine code (aka binaries). CMU BAP is
written in OCaml and uses plugin-based architecture to enable
extensibility. We also have a domain-specific language, called Primus
Lisp, that we use to write analysis, specify verification conditions,
interact with the built-in SMT solver, and model the semantics of
machine instructions and functions.
The 2.1.0 Release is very rich in [new features] but the most
prominent addition is the new [symbolic executor] mode for the Primus
framework. We also significantly updated the Primus framework,
integrated it with our new Knowledge Base, which was introduced in the
BAP 2.0 release; we made our interpreter much faster; we added the
systems and components facilities, inspired by Common Lisp; and we
implemented a gradual type checker for Primus Lisp with type
inference. We also added an ability to represent machine instructions
as intrinsic functions so now it is possible to express their
semantics using Primus Lisp since we added IEEE754 primitives to the
Lisp interpreter.
As usual, we upgraded BAP to the newer versions of the Core library
and OCaml (we now support OCaml versions from 4.07 to 4.09). We also
significantly improved our build times and added an optional omake
backend, which we are using in-house.
From the user perspective, one of the key features of BAP as an
analysis platform is that you can run BAP on binaries that you can't
run otherwise, either because they need special hardware or software,
or need to interact with the outside world. In the past couple of
months, we have run BAP on various firmware and found numerous
zero-day vulnerabilities, particular, we were able to find critical
vulnerabilities in the VxWorks operating system that runs on,
potentially, billions of devices including mission-critical and
military appliances.
As always, questions, suggestions, and opinions are very welcome!
[CMU BAP] https://github.com/BinaryAnalysisPlatform/bap
[new features]
https://github.com/BinaryAnalysisPlatform/bap/releases/tag/v2.1.0
[symbolic executor]
https://github.com/BinaryAnalysisPlatform/bap/pull/1105
Migrating an Async project to Lwt, a short primer
═════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/migrating-an-async-project-to-lwt-a-short-primer/5908/1]
Michael Bacarella announced
───────────────────────────
Consider this a post where I think aloud about my experience migrating
an Async project to Lwt. I've spent about a weekend doing such a
thing, and if, in the process of talking about it here I can save a
few people an hour or two (or perhaps inspire confidence to take such
a project on in the first place) then it will have been worthwhile.
This wouldn't be a complete post if I didn't also mention @dkim's
[translation of Real World OCaml's Async examples to Lwt]
This was born out of a previous effort where I [tried to mix Lwt and
Async in the same project]. This didn't go so well, so I tried
converting the whole thing to Lwt, and it turns out adapting to Lwt if
you're an Async person is actually much easier than I thought it would
be.
[translation of Real World OCaml's Async examples to Lwt]
https://github.com/dkim/rwo-lwt
[tried to mix Lwt and Async in the same project]
https://discuss.ocaml.org/t/best-practices-on-mixing-lwt-and-async/5372
Basics
╌╌╌╌╌╌
Both libraries involve promises/futures. Async calls its promises
`Deferred.t', whereas in Lwt they're called `Lwt.t'.
In Async you start your program by saying `never_returns (Scheduler.go
())' or `Command.async_spec' after you set up your initial
`Deferred.t'.
In Lwt you say `Lwt_main.run' on a top-level `Lwt.t' argument. Note
you can re-run `Lwt_main.run' in a single program as many times as you
want, but perhaps you shouldn't run multiple `Lwt_main.run' in
parallel.
There's an easy correspondence between basic operators.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Async Lwt
────────────────────────────────────────────────────
`Deferred.bind' `Lwt.bind'
`Deferred.return' `Lwt.return'
`>>=' `>>='
`Deferred.map' `Lwt.map'
`>>|' `>|='
`Deferred.don't_wait_for' `Lwt.async'
`In_thread.run' `Lwt_preemptive.detach'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Starvation worries
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The most important difference between Async and Lwt is that *fulfilled
promises are acted on immediately*, whereas Async kinda punts them to
the end of a work queue and runs their thunks later.
A return loop like this starves the rest of Lwt:
┌────
│ open Lwt.Infix
│
│ let main () =
│ let rec loop () =
│ Lwt.return ()
│ >>= fun () ->
│ loop ()
│ in
│ Lwt.async (loop ());
│ Lwt_io.printlf "this line never prints!"
│ ;;
│
│ let () = Lwt_main.run main ;;
└────
whereas the corresponding Async loop does not starve:
┌────
│ open! Async
│
│ let main () =
│ let rec loop () =
│ Deferred.return ()
│ >>= fun () ->
│ loop ()
│ in
│ don't_wait_for (loop ());
│ printf "this line does print!\n";
│ return ()
│ ;;
│
│ let () =
│ let cmd = Command.async_spec ~summary:"" Command.Spec.empty main in
│ Command.run cmd
│ ;;
└────
Fortunately there's a workaround. You can get something closer to the
Async-style behavior in Lwt by using `Lwt.yield ()' instead of
`Lwt.return ()'.
Spawning threads
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
From time to time you may need to run something in a system thread.
In Async you say `In_thread.run', whereas in Lwt you say
`Lwt_preemptive.detach'. For simple things they're pretty much
interchangeable, but one stumbling point for me was that in Async you
can create a named thread and always use that for the `In_thread.run',
with multiple simultaneous dispatches to that thread becoming
sequenced.
This is really useful for interacting with libraries that aren't so
thread friendly.
Lwt's detach doesn't provide an easy way to do this out of the box,
but I think you can still deal with thread unfriendly libraries by
using the `Lwt_preemptive.run_in_main' call.
Basically, never exit the detach thread you started to interact with
your library, and instead have it block on promise that gets filled
through run_in_main. In this way you can sequence your detached Lwt
thread similarly to Async.
Happy to explain further if this is unclear.
Other libraries
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
`Async.Unix' has a somewhat built-up conception of the UNIX API,
whereas `Lwt_main' is more a direct mapping of ocaml's `Unix' module
to promises.
Async `Clock.every' and `Clock.after' don't have exact analogs, but
you can make new versions pretty simply.
Example of a shallow imitation of Async `Clock.every'
┌────
│ let every span f =
│ Lwt.async (fun () ->
│ let span = Time.Span.to_sec span in
│ let rec loop () =
│ f ();
│ Lwt_unix.sleep span
│ >>= fun () ->
│ loop ()
│ in
│ loop ())
│ ;;
└────
*Open questions*
I haven't sorted out a good Lwt substitute that's as comfortable as
Async Pipe yet. Though some combination of Lwt_stream, Lwt_sequence
and `lwt-pipe' might fit the bill. If you just happen to know already
feel free to cluephone.
Closing remarks
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
This is basically everything? I'm almost suspicious that I'm not
having more problems, but will happily accept grace when it arises.
Raphaël Proust then said
────────────────────────
I haven’t sorted out a good Lwt substitute that’s as
comfortable as Async Pipe yet. Though some combination of
Lwt_stream, Lwt_sequence and `lwt-pipe' might fit the
bill. If you just happen to know already feel free to
cluephone.
The Tezos project has a pipe-like module:
[https://gitlab.com/tezos/tezos/-/blob/master/src/lib_stdlib/lwt_pipe.mli]
It hasn't been released as a standalone library (yet) but it is
released as part of the `tezos-stdlib' package.
I haven't used Async's pipe, so I don't know how close of a match it
is.
jose 0.4.0
══════════
Archive: [https://discuss.ocaml.org/t/ann-jose-0-4-0/5909/1]
Ulrik Strid announced
─────────────────────
A new release of JOSE has been published to opam
The following changes has been made
• RFC7638: Implement thumbprints @undu
• Make kid optional in the header and jwk to align better with the
spec, this is a breaking change
I have started dog fooding the library for a OpenID Connect client
which hopefully will help with the design going forward.
OCaml 4.11.0, second alpha release
══════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-4-11-0-second-alpha-release/5910/1]
octachron announced
───────────────────
A new alpha version of OCaml 4.11.0 has been published. Compared to
the first alpha version, this version contains the following new bug
fixes:
• *additional fixes* [6673], [1132], [+9617]: Relax the handling of
explicit polymorphic types (Leo White, review by Jacques Garrigue
and Gabriel Scherer)
• *additional fixes* [7364], [2188], [+9592], [+9609]: improvement of
the unboxability check for types with a single
constructor. Mutually-recursive type declarations can now contain
unboxed types. This is based on the paper
[https://arxiv.org/abs/1811.02300]
• [7817], [9546]: Unsound inclusion check for polymorphic variant
(Jacques Garrigue, report by Mikhail Mandrykin, review by Gabriel
Scherer)
• [9549], [9557]: Make -flarge-toc the default for PowerPC and
introduce -fsmall-toc to enable the previous behaviour. (David
Allsopp, report by Nathaniel Wesley Filardo, review by Xavier Leroy)
• [9320], [9550]: under Windows, make sure that the Unix.exec*
functions properly quote their argument lists. (Xavier Leroy, report
by André Maroneze, review by Nicolás Ojeda Bär and David Allsopp)
• [9490], [9505]: ensure proper rounding of file times returned by
Unix.stat, Unix.lstat, Unix.fstat. (Xavier Leroy and Guillaume
Melquiond, report by David Brown, review by Gabriel Scherer and
David Allsopp)
• [8676], [9594]: turn debugger off in programs launched by the
program being debugged (Xavier Leroy, report by Michael Soegtrop,
review by Gabriel Scherer)
• [9552]: restore ocamloptp build and installation (Florian Angeletti,
review by David Allsopp and Xavier Leroy)
• [7708], [9580]: Ensure Stdlib documentation index refers to
Stdlib. (Stephen Dolan, review by Florian Angeletti, report by
Hannes Mehnert)
• [9189], [9281]: fix a conflict with Gentoo build system by removing
an one-letter Makefile variable. (Florian Angeletti, report by Ralph
Seichter, review by David Allsopp and Damien Doligez)
The compiler can be installed as an OPAM switch with one of the
following commands
┌────
│ opam switch create ocaml-variants.4.11.0+alpha2 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
or
┌────
│ opam switch create ocaml-variants.4.11.0+alpha2+<VARIANT> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where <VARIANT> is replaced with one of these: afl, flambda, fp,
fp+flambda
The source code for the alpha is also available at these addresses:
• [https://github.com/ocaml/ocaml/archive/4.11.0+alpha2.tar.gz]
• [https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-4.11.0+alpha2.tar.gz]
If you find any bugs, please report them here:
[https://github.com/ocaml/ocaml/issues]
[6673] https://github.com/ocaml/ocaml/issues/6673
[1132] https://github.com/ocaml/ocaml/issues/1132
[+9617] https://github.com/ocaml/ocaml/issues/9617
[7364] https://github.com/ocaml/ocaml/issues/7364
[2188] https://github.com/ocaml/ocaml/issues/2188
[+9592] https://github.com/ocaml/ocaml/issues/9592
[+9609] https://github.com/ocaml/ocaml/issues/9609
[7817] https://github.com/ocaml/ocaml/issues/7817
[9546] https://github.com/ocaml/ocaml/issues/9546
[9549] https://github.com/ocaml/ocaml/issues/9549
[9557] https://github.com/ocaml/ocaml/issues/9557
[9320] https://github.com/ocaml/ocaml/issues/9320
[9550] https://github.com/ocaml/ocaml/issues/9550
[9490] https://github.com/ocaml/ocaml/issues/9490
[9505] https://github.com/ocaml/ocaml/issues/9505
[8676] https://github.com/ocaml/ocaml/issues/8676
[9594] https://github.com/ocaml/ocaml/issues/9594
[9552] https://github.com/ocaml/ocaml/issues/9552
[7708] https://github.com/ocaml/ocaml/issues/7708
[9580] https://github.com/ocaml/ocaml/issues/9580
[9189] https://github.com/ocaml/ocaml/issues/9189
[9281] https://github.com/ocaml/ocaml/issues/9281
OCaml Workshop 2020: Call for Volunteers
════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-workshop-2020-call-for-volunteers/5913/1]
Ivan Gotovchits announced
─────────────────────────
The OCaml Workshop will be held in the virtual format this year, which
poses new challenges and requires people with special talents and
training. The Organizing Committee is seeking for members who will
volunteer to fill one (or more) of the following roles:
1. AV Editor
2. Session Host
3. Transcribers/Interpreter
4. Content Manager
5. Accessibility Chair
The roles are described in details below. We are asking prospective
Organizing Committee members to contact the Organizing Committee chair
([ivg@ieee.org]([mailto:ivg@ieee.org])), indicating which role(s) they
are ready to take.
[AV Editor]
╌╌╌╌╌╌╌╌╌╌╌
AV (Audio/Video) editors are responsible for previewing the
presentations and providing help and feedback to the authors. Ideally
we target for one editor per talk.
[AV Editor] https://icfp20.sigplan.org/home/ocaml-2020#av-editor
◊ [Duties]
• Preview and (if necessary) post-process or (ask the author to shoot
again) the pre-recorded videos.
• Advise authors and help in choice of software and hardware, teach
how to set up the camera, light, make sure that the audio is of good
quality and, in general, channel our quality guidelines.
• Ensure that all videos are of the same quality, the audio levels are
the same, and that everything is loud and clear.
[Duties] https://icfp20.sigplan.org/home/ocaml-2020#duties
[Session Hosts]
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Session hosts will assist session chairs in streaming the pre-recorded
videos as well as helping and moderating the Q&A sessions and the
panel session. They will also be responsible for security and be ready
to react to potential threats and wrongdoers. Since we will broadcast
sessions in several time zones we need several hosts for each session.
[Session Hosts] https://icfp20.sigplan.org/home/ocaml-2020#session-hosts
◊ [Duties]
• Moderating the text chats
• Controlling microphones in the video-conferencing
• Watching for the time
• Performing sound checks
• Welcoming and otherwise guiding participants
[Duties] https://icfp20.sigplan.org/home/ocaml-2020#duties
[Transcribers / Interpreters]
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
We would like to have at least English transcriptions for each talk
and translations to other languages are very welcome. Transcriptions
enable accessibility as well as potentially increase the audience and
publicity as they could be indexed by the search engines.
[Transcribers / Interpreters]
https://icfp20.sigplan.org/home/ocaml-2020#transcribers-interpreters
◊ [Duties]
• Create transcriptions for videos, potentially in other languages.
[Duties] https://icfp20.sigplan.org/home/ocaml-2020#duties
[Content Manager]
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The content manager will be responsible for maintaining the web
presence of the conference on [https://ocaml.org/]. We plan to have
all videos available, as well as maintain a page for each submitted
work.
[Content Manager]
https://icfp20.sigplan.org/home/ocaml-2020#content-manager
[Accessibility Chair]
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
We are striving to make the conference accessible to everyone and we
are looking for volunteers who have experience in online
accessibility.
[Accessibility Chair]
https://icfp20.sigplan.org/home/ocaml-2020#accessibility-chair
◊ [Duties]
• Helping with the selection of accessible platforms and tools.
• Working with attendees to ensure the necessary access services are
included.
• Establishing best practices for preparing and running accessible
sessions.
[Duties] https://icfp20.sigplan.org/home/ocaml-2020#duties
Introduction to Lwt
═══════════════════
Archive: [https://discuss.ocaml.org/t/introduction-to-lwt/5940/1]
Raphaël Proust announced
────────────────────────
I've published
[https://raphael-proust.github.io/code/lwt-part-1.html], a 2-part
introduction to Lwt.
The main aim of the introduction is to give a good mental model of
what promises are, how they behave and how to use them. It assumes
basic familiarity with OCaml.
Don't hesitate to ask questions or share feedback.
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Using ASCII waveforms to test hardware designs]
[OCaml Planet] http://ocaml.org/community/planet/
[Using ASCII waveforms to test hardware designs]
https://blog.janestreet.com/using-ascii-waveforms-to-test-hardware-designs/
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2: Type: text/html, Size: 46346 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-05-19 9:52 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-05-19 9:52 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 26620 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of May 12 to 19,
2020.
Table of Contents
─────────────────
ocamlformat 0.14.2
ML Family Workshop 2020: Call for presentations
memprof-limits preview (and a guide to handle asynchronous exceptions)
Tezos 7.0 is now available on opam
Official OCaml bindings for verified Everest cryptography
nmea and sail-gadgets
Is there specialized math library for statistics?
New OCaml books?
Other OCaml News
Old CWN
ocamlformat 0.14.2
══════════════════
Archive: [https://discuss.ocaml.org/t/ann-ocamlformat-0-14-2/5754/1]
Guillaume Petiot announced
──────────────────────────
We are pleased to announce the release of `ocamlformat' 0.14.2. This
minor release improves the recent 0.14.0 and 0.14.1 releases regarding
the `doc-comments' option.
How to migrate from 0.13.0
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Here are the changes of the `doc-comments' options compared to
ocamlformat 0.13.0:
• `after' has been renamed to `after-when-possible' to take into
account the technical limitations of ocamlformat;
• a new value `before-except-val' has been added, placing doc-comments
before the corresponding code, but placing doc-comments of val and
external declarations after the corresponding declaration;
• `before' is unchanged.
Here is the full list of changes made by the 0.14.0 release:
[https://discuss.ocaml.org/t/ann-ocamlformat-0-14-0/5435]
How to migrate from 0.14.0
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The 0.14.0 release lead to some regression of the `doc-comments'
behavior that (although intended for us) lead to some surprise from a
lot of users. The behavior of `doc-comments' has thus been reverted
to it's 0.13.0 state with the following changes:
The `doc-comments-val' option has been removed and merged with
`doc-comments'. The placement of documentation comments on `val' and
`external' items is now controlled by `doc-comments' .
• `doc-comments=after' becomes `doc-comments=after-when-possible' to
take into account the technical limitations of ocamlformat;
• `doc-comments=before' is unchanged;
• `doc-comments-val' is now replaced with `doc-comments'
To reproduce the former behaviors
• `doc-comments=before' + `doc-comments-val=before' : now use
`doc-comments=before' ;
• `doc-comments=before' + `doc-comments-val=after' : now use
`doc-comments=before-except-val' ;
• `doc-comments=after' + `doc-comments-val=before' : this behavior did
not make much sense and is not available anymore;
• `doc-comments=after' + `doc-comments-val=after' : now use
`doc-comments=after-when-possible'.
How to migrate from 0.14.1
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The 0.14.1 release was preserving the behavior of 0.13.0 regarding
`doc-comments', it added a `unset' value to the `doc-comments-val'
option. This option has been removed with the following changes:
The `doc-comments-val' option has been removed and merged with
`doc-comments'. The placement of documentation comments on `val' and
`external' items is now controlled by `doc-comments' .
• `doc-comments=after' becomes `doc-comments=after-when-possible' to
take into account the technical limitations of ocamlformat;
• `doc-comments=before' is unchanged;
• `doc-comments-val' is now replaced with `doc-comments'
To reproduce the former behaviors
• `doc-comments=before' + `doc-comments-val=before' : now use
`doc-comments=before' ;
• `doc-comments=before' + `doc-comments-val=after' : now use
`doc-comments=before-except-val' ;
• `doc-comments=after' + `doc-comments-val=before' : this behavior did
not make much sense and is not available anymore;
• `doc-comments=after' + `doc-comments-val=after' : now use
`doc-comments=after-when-possible'.
Thank you
╌╌╌╌╌╌╌╌╌
We would like to thank our early users to help us on the road of a
stable 1.0.0 release of ocamlformat.
ML Family Workshop 2020: Call for presentations
═══════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ml-family-workshop-2020-call-for-presentations/5441/4]
Leo White announced
───────────────────
ICFP, and by extension the ML workshop, will be now officially be held
online with a significantly reduced fee. Due to the change in official
status we decided to extend the submission deadline to the end of May.
Important Dates (updated)
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Friday 29th May (any time zone): Abstract submission deadline
• Friday 17th July: Author notification
• Thursday 27th August: ML Family Workshop
memprof-limits preview (and a guide to handle asynchronous exceptions)
══════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-memprof-limits-preview-and-a-guide-to-handle-asynchronous-exceptions/5756/1]
Guillaume Munch-Maccagnoni announced
────────────────────────────────────
Dear OCamlers, I am happy to pre-announce [memprof-limits], an
implementation of per-thread global memory limits, and per-thread
allocation limits à la Haskell, compatible with systhreads.
Memprof-limits interrupts the execution by raising an _asynchronous
exception_, an exception that can arise at almost any location in the
code. I also announce [a guide on how to recover from asynchronous
exceptions and other unexpected exceptions] that you find in the
documentation. It summarises knowledge acquired in OCaml by the Coq
proof assistant as well as in other programming languages. To my
knowledge, this has never been told in OCaml textbooks, so I thought
it might be of general interest to you. This research is part of a
wider work aiming to regulate the use of asynchronous exceptions in
OCaml in coordination with multicore language designers.
_Global memory limits_ let you bound the memory consumption inside
specific parts of your program, in terms of memory used by the whole
program. It is inspired by [this other post], but in a form readily
available for use with systhreads.
_Allocation limits_ let you bound the execution of parts of the
program measured in number of allocations, analogous to the same
feature in Haskell advocated in [a nice post by Simon
Marlow]. Allocation limits count allocations but _not_ deallocations,
and is therefore a measure of the work done, which can be more
suitable than execution time.
Memprof-limits, as the name tells, uses the upcoming Memprof engine
from OCaml 4.11, with a low sampling rate that does not affect
performance. A reimplementation of the Memprof interface compatible
with memprof-limits running at the same time is provided for profiling
needs.
Memprof-limits is available on the public opam repository, but depends
on OCaml 4.11 which at the moment is available from the beta opam
repository only. It is _experimental_ for reasons explained in the
manual.
[memprof-limits] https://gitlab.com/gadmm/memprof-limits
[a guide on how to recover from asynchronous exceptions and other
unexpected exceptions] https://gitlab.com/gadmm/memprof-limits#recover
[this other post]
https://discuss.ocaml.org/t/todays-trick-memory-limits-with-gc-alarms/4431
[a nice post by Simon Marlow]
https://simonmar.github.io/posts/2017-01-24-asynchronous-exceptions.html
FAQ
╌╌╌
◊ “Is it wise to rely on the statistical nature of Memprof? If I set an allocation limit of 100 KB, and run a function that allocates exactly 50 KB, then the function might fail, due to the random nature of Memprof.”
Memprof-limits is provided with a [statistical analysis] meant to help
you chose appropriate values for the limit depending on a target safe
allocation value. (Nice pictures omitted because this discuss does not
support svg.)
Long story short, memprof-limits starts being accurate-enough starting
around a safe allocation value of 100 KB with the default sampling
rate (meaning a limit of 1 to 3 MB depending on chosen precision),
with the ratio between the maximal safe allocation and the limit
dropping very quickly for higher values. Correctly, the analysis shows
that limits under 500 KB are unreliable.
I have found that the statistical nature of Memprof makes it very easy
to reason about its application and not have to factor in runtime
implementation details. In addition, Memprof is nevertheless
deterministic, which is (essential and) useful for reproducing runs in
test scenarios.
[statistical analysis]
https://gitlab.com/gadmm/memprof-limits#statistical
◊ “But can we really program with memprof-limits, that is, not only write programs but also reason about them, given the probabilistic nature of the guarantees?”
Yes, if we make two additional hypotheses:
1. Allocation limits (as used in Haskell) are used by determining peak
reasonable allocation usage empirically and picking a limit at a
comfortable margin over it, rather than computing a precise memory
bound to be used as a limit. In very controlled environments where
the latter would be possible, there probably would be better
solutions, and the language this is inspired from makes it very
hard to make predictions on memory use.
2. The programmer is fine with a very unlikely possibility of a false
positive; indeed the program is already designed to let true
positives fail without bringing down mission-critical parts of the
program. For instance they can prefer to see a legitimate client
having a connexion closed once every 10ⁿ year for *n* of their
choosing, if that is the price to pay for avoiding being subject to
DOS on maliciously-crafted requests.
Under these hypotheses, the statistical limit is just as reliable as
the precise limits à la Haskell.
◊ “Is it possible to also implement _local memory limits_, to bound the memory consumption of a particular function?”
Yes but read on.
[Yang & Mazières (2014)] advocates in favour of an _allocator-pays_
model of cost attribution, and note its similarity with memory
profiling. In this model, it is possible for instance to process
untrusted user input under some memory limit, before the result is
distributed to the rest of the program.
Implementing memory limits based on the allocator-pays model, by
adapting allocation limits to take into account deallocations, would
be very easy thanks to the facilities provided by Memprof. Moreover,
the statistical analysis of allocation limits can be transposed, and
guarantees similarly accuracy at a low runtime cost for limits greater
than 100KB.
There is one surprising difficulty, though, which has to do with the
way the GC works. The GC has a space overhead: memory that is wasted
because unreachable values are not collected immediately. This
overhead has to be taken into account when choosing the
limit. However, this overhead is non-local and dependent on the
_total_ major heap size: one cannot just say “take the double of the
desired limit”. Indeed, active threads will pay for memory that has
been allocated in the past and kept alive. More experimentation is
needed to provide guidance on how to take the space overhead into
account.
[Yang & Mazières (2014)]
https://dl.acm.org/doi/10.1145/2594291.2594341
◊ “Can this be used to bound the consumption of lightweight threads in Lwt and Async?”
It is straightforward to make memprof-limits parametric in the notion
of _thread id_ used to track per-thread limits. However, to the best
of my knowledge, Lwt and Async are not meant to play well when the
computation is interrupted by asynchronous exceptions. If you have
more information about this limitation or are interested in
experimenting, please get in touch.
Thanks
╌╌╌╌╌╌
Thank you to Jacques-Henri Jourdan for his explanations about Memprof
and Stephen Dolan for his feedback.
Tezos 7.0 is now available on opam
══════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-tezos-7-0-is-now-available-on-opam/5764/1]
Pierre Boutillier announced
───────────────────────────
Tezos executables and libraries have just been released on `opam'. You
can thus build them from source with a simple `opam install tezos' and
build your own projects upon them.
What is Tezos
╌╌╌╌╌╌╌╌╌╌╌╌╌
Tezos is a distributed consensus platform with meta-consensus
capability. Tezos not only comes to consensus about the state of its
ledger, like Bitcoin or Ethereum. It also comes to consensus about how
the protocol and the nodes should adapt and upgrade. For more
information about the project, see [https://tezos.com].
Our implementation of Tezos is written in OCaml. It is split into
several libraries (command-line interface `tezos-clic', peer-to-peer
library `tezos-p2p', cryptographic primitives `tezos-crypto~…) and
executables (node ~tezos-node', client ~tezos-client~…).
Useful Links
╌╌╌╌╌╌╌╌╌╌╌╌
Source code for this particular implementation can be found at
[https://gitlab.com/tezos/tezos/]. Developer documentation is
available at [https://tezos.gitlab.io/]. In particular, documentation
for this specific release (version 7.0) is available at
[http://tezos.gitlab.io/releases/version-7.html].
Installation Instructions
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Tezos (internal compiler in order to self amend itself) requires a
specific version of the compiler (OCaml 4.09.1):
┌────
│ opam switch 4.09.1
└────
Tezos also requires some external libraries:
┌────
│ opam depext tezos
└────
Finally, to install all binaries:
┌────
│ opam install tezos
└────
Replying to Nick Betteridge, Raphaël Proust said
────────────────────────────────────────────────
Tezos has a soft-updating mechanism that works (roughly) as follows:
The network starts with a genesis protocol (“protocol” here means
“economic protocol”: the rules according to which smart contracts are
initiated and acted upon, transactions take place, etc.) in which a
single public key is specified.
The genesis protocol has no notion of coin, currency, smart-contract,
etc. Instead, the genesis protocol knows a single operation: a
protocol injection.
The protocol injection for genesis requires the operation to be signed
by the private key that matches the public key of the genesis
block. And the protocol injection changes, irreversibly, the genesis
protocol to a new protocol. This new protocol specifies what
constitutes a valid block to add to the chain.
In the Tezos blockchain, the protocol injected on top of genesis
included a notion of coins and an in-protocol voting system to inject
new protocols based on consensus amongst coin-holders. There is even a
system to obtain the protocol sources over the blockchain network so
they can be compiled by each node and dynlinked directly in: you don't
need to update/restart your node to get the protocol updates. However,
this is arbitrary: you can start a new block-chain with a different
protocol.
For example, you could re-implement Bitcoin (proof-of-work,
coins+transfer, etc.) as a protocol that you inject on top of
genesis. Your block chain would have a tezos genesis block, then a
block that activate your own version of bitcoin, and then the blocks
would be similar to what you would find on the bitcoin block-chain.
Of particular interest to you, the protocol you inject can have
entirely different on-chain notions (e.g., a TCG/CCG with no coins at
all but a notion of ownership over cards) and different soft-updating
mechanism (e.g., the new protocol can accept genesis-style updates (a
“dictatorship” where a single person controls the protocol) or even no
soft-updating mechanism at all (a “stale” protocol where you need to
hard-fork if you want to make significant changes)).
For this use case (of starting your own chain with a different
protocol), you might be better off cloning the git repository, doing
some minimal clean up, etc. This is because the tezos binaries include
the sources for all protocols that have been used on the chain (so you
don't *need* to get them over the network even if you can).
You might be interested in the following blog post about how to write
your own protocol:
[https://blog.nomadic-labs.com/how-to-write-a-tezos-protocol.html]
Official OCaml bindings for verified Everest cryptography
═════════════════════════════════════════════════════════
Archive:
[https://sympa.inria.fr/sympa/arc/caml-list/2020-05/msg00017.html]
Jonathan Protzenko announced
────────────────────────────
The Everest team is pleased to announce the release of official OCaml
bindings for all of our verified cryptographic algorithms, now
available through OPAM as packages hacl-star and hacl-star-raw.
We provide bindings for the following:
• HACL*, a library of pure C algorithms
• Vale, a collection of optimized core assembly routines for maximum
performance
• EverCrypt, an agile, multiplexing API with CPU auto-detection that
brings together HACL* and Vale.
Our code is compiled from the F* programming language to C via the
KReMLin compiler ("K&R meets ML"). We offer two OPAM packages:
• hacl-star-raw consists of low-level ocaml-ctypes bindings generated
by KReMLin
• hacl-star is a hand-written OCaml idiomatic API that uses much more
pleasant signatures, types and abstractions and is also safer, as it
checks all static preconditions at run-time
We support AES{128,256}-GCM, Chacha20-Poly1305, Curve25519 / Ed25519,
P256, MD5, SHA-{1,2,3} (all variants), Blake2 (s&b), HMAC/HKDF, and
the HPKE and SecretBox high-level APIs. Some algorithms are optimized
for Intel chips, notably AES-GCM – see
[https://hacl-star.github.io/Supported.html] for full details.
General documentation about the project is available at
[https://hacl-star.github.io/index.html] – sample code for the OCaml
API is provided as part of the test suite
[https://github.com/project-everest/hacl-star/tree/master/bindings/ocaml/tests]
This work was performed by Victor Dumitrescu from Nomadic Labs, one of
the teams responsible for the core development of the Tezos
blockchain.
nmea and sail-gadgets
═════════════════════
Archive: [https://discuss.ocaml.org/t/ann-nmea-sail-gadgets/5773/1]
Davide Gessa announced
──────────────────────
Ahoy developers, few days ago I published a new ocaml library called
*nmea*, which is essentially a parser for NMEA0183 sentences, a format
for encoding instruments data in boats. There are many sentences,
regarding GPS, compass data, wind, air pressure, water temperature,
waypoints handling, ais, autopilot and more; at the moment the library
is able to decode GPS sentences and compass data, but I'll implement
more sentences in the spare time. I tested it with my boat GPS and
with a gps usb dongle.
After that, I started a new tiny experiment called *sail-gadgets*,
which is a Gtk program that elaborates and displays NMEA data received
from various boat instruments (wind vane, autopilot, gps, radar, ais,
etc). Sail-gadgets can be extended with "gadgets" modules, each one
providing new functionalities and new tabs to the main interface.
Data from sensors are handled using /React/ signals, so in every
gadget we can compose data from various sensor to obtain new reactive
values.
The gadgets I'm planning to write:
• dashboard: shows current position, speed, heading, tripdist, compass
• satview: shows current connected gps satellites (partially done)
• wind: shows wind indicator with true / apparent speed and direction
• radar: shows AIS and Radar targets in range
• mob: allows to drop a marker in the current position, and drive you
to that point
• startline: helper for regatta start
• track: shows current track in a vector map
The hard thing in my opinion is writing new custom widget with cairo
(compass, radar, and things like that).
Finally, the project is intended to run over *gtk-broadway*, so every
html5 enabled device can access the application.
[https://raw.githubusercontent.com/dakk/sail-gadgets/master/media/broadway.jpg]
Hope there are some sailor here that want to join writing some gadgets
:) Repos are:
• [https://github.com/dakk/nmea]
• [https://github.com/dakk/sail-gadgets]
Is there specialized math library for statistics?
═════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/is-there-specialized-math-library-for-statistics/5778/1]
hss asked
─────────
I searched to find math library which is written in OCaml, but there
are only few repositories.
I'd like to use some function like coefficient correlation,
covariance, etc.
I found Lacaml but it seems not to support them.
Could you give some link if you know?
bnguyenvanyen replied
─────────────────────
Hi, you can take a look at Owl : [https://ocaml.xyz/]
There are stat functions and also a lot more
UnixJunkie also replied
───────────────────────
There is also this one:
[https://github.com/superbobry/pareto]
GSL powered OCaml statistics library
[http://superbobry.github.io/pareto/0.2]
And probably even some more:
┌────
│ opam search statistic
│ # Packages matching: match(*statistic*)
│ # Name # Installed # Synopsis
│ [...]
│ gsl -- GSL - Bindings to the GNU Scientific Library
│ oml -- Math Library
│ owl -- OCaml Scientific and Engineering Computing
│ owl-plplot -- OCaml Scientific and Engineering Computing
│ pareto -- GSL powered OCaml statistics library.
│ statsd-client -- StatsD client library
│ [...]
└────
New OCaml books?
════════════════
Archive: [https://discuss.ocaml.org/t/new-ocaml-books/5789/1]
Axel Wintermann asked
─────────────────────
I wonder, why there are no new OCaml books since 2014 year? Many books
are published on Haskell, Scala, F# themes, but no OCaml. I think we
need new books for learning and for rising interest in our beautiful
language.
Takuma Ishikawa replied
───────────────────────
• There is an ongoing work for 2nd edition of Real World OCaml:
[http://dev.realworldocaml.org/].
• OCaml Scientific Computing is also ongoing:
[https://ocaml.xyz/book/].
• A Japanese book "コンピュータを操る", published in Feb. 2020 for
beginners of programming, uses OCaml Blockly:
[https://www.saiensu.co.jp/search/?isbn=978-4-7819-1470-1&y=2020#detail].
Weng Shiwei also replied
────────────────────────
A Chinese book [OCaml语言编程基础教程] ([an introduction to OCaml
language programming]) is published in 2018.
[OCaml语言编程基础教程] https://e.jd.com/30417662.html
[an introduction to OCaml language programming]
https://caml.inria.fr/about/books.en.html#idm277
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Every proof assistant: MMT]
[OCaml Planet] http://ocaml.org/community/planet/
[Every proof assistant: MMT]
http://math.andrej.com/2020/05/15/mmt-a-foundation-independent-logical-system/
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2: Type: text/html, Size: 42565 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-05-12 7:45 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-05-12 7:45 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 15797 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of May 05 to 12,
2020.
Table of Contents
─────────────────
Looking for "lovely, idiomatic" examples of Ocaml used for shell-scripting in the manner of Perl/Python (but esp. Perl)
Are there learning materials for OCaml for those with no programming experience?
Dune meeting notes
OCaml 4.11.0, first alpha release
OCaml Users and Developers Meeting 2020
VSCode Platform Plugin 0.5.0
Other OCaml News
Old CWN
Looking for "lovely, idiomatic" examples of Ocaml used for shell-scripting in the manner of Perl/Python (but esp. Perl)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/looking-for-lovely-idiomatic-examples-of-ocaml-used-for-shell-scripting-in-the-manner-of-perl-python-but-esp-perl/5703/13]
Continuing this thread, Chet Murthy said and Aaron L. Zeng replied
──────────────────────────────────────────────────────────────────
• needs to be Ocaml code, not an interpreter. I mean, if
I’m not going to write it in Ocaml, I might as well
write in Perl, yes?
I think shexp might deserve another look. It's not an interpreter for
a sexp-based shell language, as its name might unfortunately
deceivingly suggest. It's really a DSL for constructing shell
pipelines using a `'a Process.t' monad. The s-expression part is
advertising that you can debug and trace the actions performed using
s-expressions.
The second-most-important part of Perl/Bash scripting is
string-handling. And it’s certainly the part of Ocaml
that’s most painful when writing scripts. Let’s stipulate
that there are nice libraries to make this easy. I’m an
Ocaml bigot, I have to believe this anyway *grin* . This
library doesn’t seem to use 'em, nor choose/promote a
particular set of such libraries.
I've found [Base] plus [Re] to be sufficient for most of my
string-manipulation needs. It's never going to be as concise as
Perl's built-in "magic" support for regexps, but you gain explicitness
and clarity, which is part of the benefit of OCaml anyway.
[Base] https://github.com/janestreet/base/
[Re] https://github.com/ocaml/ocaml-re
Chet Murthy said and Donn Cave replied
──────────────────────────────────────
It’s not as trivial in Ocaml, for many complicated reasons
that boil down to “gee, string-handling is a PITA”.
Really? hadn't noticed. Ha ha.
I could never really get urge for Perl, but I use its ancestor awk a
lot, and I'm trying out some awk-like simple string functions, like
┌────
│ let strlen = String.length
│ let sub s i n = let b = strlen s
│ in if i < b
│ then let n = min n (b - i)
│ in String.sub s i n
│ else ""
│ (* substring to end of line *)
│ let substr a i = if i < strlen a
│ then String.sub a i ((strlen a) - i)
│ else ""
│ let matchre t s = try
│ Str.search_forward t s 0
│ with | Not_found -> -1
└────
etc.
So "open Awk" gets me a handful of more basic variations on common
string functions, with less elaborate parameters, no normal
exceptions, etc. Including a line by line file processing function.
I have just newly started on this and haven't used it extensively, but
it seems fairly promising. No wacky syntax or hyper intelligent
string processing, no packages, just a few dozen lines of cheater
functions.
"Awk" is a misnomer, in that there's little correspondence between
this and awk, it was just what inspired me to try it.
Raphaël Proust said
───────────────────
I don't think it's lovely and I have no idea if it is idiomatic, but I
made a few scripts of my own in OCaml using the same library that
other mentioned: `bos'
• [typepass] uses `xdotool' to type passwords from the `password'
password manager
• [conn] wraps `wpa_supplicant', `dhcpcd', `ip', and other network
management CLI
• [laptop-status] fetches status information for laptops (e.g.,
battery level) and prints it in a nicely formatted form
• [bakelite] increases or decreases screen brightness
[typepass] https://gitlab.com/raphael-proust/typepass
[conn] https://gitlab.com/raphael-proust/conn
[laptop-status] https://gitlab.com/raphael-proust/laptop-status
[bakelite] https://gitlab.com/raphael-proust/bakelite
Vasile Rotaru also said
───────────────────────
[https://github.com/hammerlab/genspio]
Gabriel Radanne also said
─────────────────────────
I have no particular opinion about the rest, but at least on the regex
side, this might be of interest:
[https://github.com/paurkedal/ppx_regexp]
If that's still not good enough, I would be very interested by
suggestions on how to make it more convenient. :)
OCamlUser proposed
──────────────────
I'm not sure about idiomatic, but I do have a utop config that I use
to do some one-off scripting in OCaml that uses `shexp'
┌────
│ #use "topfind"
│ #warnings "+a"
│ #thread
│ #require "ppx_jane,core"
│ #require "shexp.process"
│ #require "lambdasoup"
│ module List' = List
│ open Shexp_process
│ open Shexp_process.Infix
│ open Core
│
│ module Html = struct
│ include Soup
│
│ let of_string = parse
│ end
│
│ let read_lines cmd =
│ eval (call cmd |- read_all)
│ ;;
│
│ let wget url =
│ read_lines ["wget"; "-O"; "-"; url]
│ ;;
│
│ let chrome_curl url =
│ read_lines ["curl"; "-k"; "-sA"; "Chrome"; "-L"; url; "-o"; "-"]
│ ;;
│
│ let split_lines = String.split ~on:'\n'
│ let filter_lines substring = List.filter ~f:String.(is_substring ~substring)
│ let to_html = Html.of_string
│ let find_html pat html = Html.(html $$ pat)
│
│ let (%) = Fn.compose
└────
Then a simple script called `shexp' in my path:
┌────
│ utop -init ~/bin/ocaml-shexp-config
└────
I add little helper functions as I come upon them. I find it's much
easier to transition to a file, or full program when I need
it. Example program:
┌────
│ utop # read_lines ["sensors"] |> split_lines |> filter_lines "Core 0";;
│ - : string list =
│ ["Core 0: +63.0°C (high = +84.0°C, crit = +100.0°C)"]
└────
Anton Kochkov said
──────────────────
Not exactly OCaml, but can be made with the OCaml syntax as well - see
[BATSH].
[BATSH] https://github.com/batsh-dev-team/Batsh
Bikal Lem also said
───────────────────
I just found this - [https://github.com/ShamoX/cash]. @Chet_Murthy
This may be the closest to ocaml shell scripting experience re perl.
Are there learning materials for OCaml for those with no programming experience?
════════════════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/are-there-learning-materials-for-ocaml-for-those-with-no-programming-experience/5684/9]
Continuing this threaad, Luc_ML said
────────────────────────────────────
Before studying more complex books, it's a good idea to first get an
overview.
[OCaml for the Skeptical / OCaml in a Nutshell] : the title is funny;
its main advantage is that it covers most OCaml concepts in *21 short
sections* where you can experiment by yourself on simple but essential
things.
The books/courses already mentioned are nice. You can also consider
this one that offers many examples/exercises and also a good overview:
[Developing Applications With Objective Caml].
LE LANGAGE CAML mentioned by @nojb is an excellent book. Written in
Caml Light, it's easy to turn it by yourself into OCaml. It offers a
great chance to learn how to do a lot of things in *pure* Caml with
only stdlib and a simple syntax extension system (use camlp5 (i.e. the
"genuine camlp4") that is fine for that. It works out of the box to
deal with streams and it's a chance to understand what is a
LL(1)/recursive descent parser).
[OCaml for the Skeptical / OCaml in a Nutshell]
https://www2.lib.uchicago.edu/keith/ocaml-class/class-01.html
[Developing Applications With Objective Caml]
https://caml.inria.fr/pub/docs/oreilly-book/
Dune meeting notes
══════════════════
Archive: [https://discuss.ocaml.org/t/dune-meeting-notes/5710/1]
Jérémie Dimino announced
────────────────────────
I just wanted to publicise that we are now publishing the notes from
our Dune meetings on the wiki:
[https://github.com/ocaml/dune/wiki]
These meetings happen via video-conference every two weeks. If you are
interested in following the development of Dune more closely, this is
good place to look at.
OCaml 4.11.0, first alpha release
═════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-4-11-0-first-alpha-release/5716/1]
octachron announced
───────────────────
The set of new features for the future version 4.11.0 of OCaml has
been frozen. In the next few months, the OCaml compiler team is
focusing on bug hunting and fixing.
For this release cycle, we have decided to test publishing regularly
alpha versions of OCaml 4.11.0 in order to help fellow hackers join us
early in our bug hunting and opam ecosystem fixing fun. Once the opam
ecosystem is in shape, these alpha releases will morph into the usual
beta and release candidate releases.
If you find any bugs, please report them here:
[https://github.com/ocaml/ocaml/issues]
The compiler can be installed as an OPAM switch with one of the
following commands
┌────
│ opam switch create ocaml-variants.4.11.0+alpha1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
or
┌────
│ opam switch create ocaml-variants.4.11.0+alpha1+VARIANT --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git
└────
where you replace VARIANT with one of these: afl, flambda, fp,
fp+flambda
The source code for the alpha is also available at these addresses:
[https://github.com/ocaml/ocaml/archive/4.11.0+alpha1.tar.gz]
[https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-4.11.0+alpha1.tar.gz]
If you are interested by the ongoing list of new features and fixed
bugs, the updated change log for OCaml 4.11.0 is available at:
[https://github.com/ocaml/ocaml/blob/4.11/Changes]
OCaml Users and Developers Meeting 2020
═══════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ocaml-users-and-developers-meeting-2020/5454/2]
Ivan Gotovchits announced
─────────────────────────
Due to the multiple requests and since ICFP will be now officially
held online with a significantly reduced fee, we decided to extend the
submission deadline till the end of this month. We are hoping to
attract a larger and more diverse audience this year, given that the
new format is more accessible both travel-wise and financially.
Please, share the news widely!
Important Dates (updated)
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Talk proposal submission deadline: May 29th, 2020, AoE
• Author Notification: July 17th, 2020
• OCaml Workshop: August 28th, 2020
VSCode Platform Plugin 0.5.0
════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-vscode-platform-plugin-0-5-0/5752/1]
Rudi Grinberg announced
───────────────────────
This release contains a couple of major improvements:
• Syntax highlighting is vastly improved. There's now highlighting for
many more filetypes, and the core highlighting for OCaml is far more
accurate.
• There's integration with package managers such as opam and esy. One
may now explicitly use them to explicitly select the sandbox that
contains the lsp server and related tools.
Under the hood, the entire plugin was rewritten from typescript to
OCaml (bucklescript). This should hopefully make contribution more
accessible to OCaml hackers.
I'd like to thank @rustykey, @mnxn, @prometheansacrifice, and @imbsky
for their contributions to this release. Their help is the reason for
this vastly improved version of the plugin.
As usual, the plugin is available directly using vscode's extension
market place. I'll leave a link to the plugin [here] to avoid
confusion with the many other OCaml plugins available.
Please report any issues on the [bug tracker]
[here]
https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform
[bug tracker] https://github.com/ocamllabs/vscode-ocaml-platform/issues
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Ocsigen Start 2.18 released]
• [Ocsigen Toolkit 2.7 with new widget Ot_tongue]
[OCaml Planet] http://ocaml.org/community/planet/
[Ocsigen Start 2.18 released]
https://ocsigen.github.io/blog/2020/05/05/os/
[Ocsigen Toolkit 2.7 with new widget Ot_tongue]
https://ocsigen.github.io/blog/2020/05/04/ot/
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2: Type: text/html, Size: 33105 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-05-05 7:45 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-05-05 7:45 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 12736 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of April 28 to May
05, 2020.
Table of Contents
─────────────────
Lwt now has let* syntax
JOSE 0.3.0 - Now with 100% more encryption
Are there learning materials for OCaml for those with no programming experience?
The recent evolution of utop, lambda-term, zed and underneath projects
Looking for "lovely, idiomatic" examples of Ocaml used for shell-scripting in the manner of Perl/Python (but esp. Perl)
Old CWN
Lwt now has let* syntax
═══════════════════════
Archive: [https://discuss.ocaml.org/t/lwt-now-has-let-syntax/5651/1]
Anton Bachin announced
──────────────────────
[Lwt] now has `let*' and `let+' syntax, which can be used like this:
┌────
│ open Lwt.Syntax
│
│ let () =
│ let request =
│ let* addresses = Lwt_unix.getaddrinfo "google.com" "80" [] in
│ let google = Lwt_unix.((List.hd addresses).ai_addr) in
│
│ Lwt_io.(with_connection google (fun (incoming, outgoing) ->
│ let* () = write outgoing "GET / HTTP/1.1\r\n" in
│ let* () = write outgoing "Connection: close\r\n\r\n" in
│ let* response = read incoming in
│ Lwt.return (Some response)))
│ in
│
│ let timeout =
│ let* () = Lwt_unix.sleep 5. in
│ Lwt.return None
│ in
│
│ match Lwt_main.run (Lwt.pick [request; timeout]) with
│ | Some response -> print_string response
│ | None -> prerr_endline "Request timed out"; exit 1
└────
This is now released in Lwt [5.3.0]. Thanks to Rahul Kumar for adding
`let*', and @CraigFe for adding `let+'!
[Lwt] https://github.com/ocsigen/lwt
[5.3.0] https://github.com/ocsigen/lwt/releases/tag/5.3.0
Thomas Coopman asked
────────────────────
Awesome this looks great.
2 quick questions:
1. I don't see this new version documented on ocsigen yet? Is that a
build that needs to be done manually?
2. Is `ppx_lwt' still recommend for some usecases like `try%'? For
what cases is one preferred over the other?
Anton Bachin replied
────────────────────
Good questions :slight_smile:
1. The docs generation is blocked on an Ocsigen "internal" package
`wikidoc', which has not been updated to support 4.08. So,
effectively, `let*' is exactly what is preventing docs generation
for the time being. I'll post the docs as soon as that is fixed.
2. `ppx_lwt' is probably still the recommended way, because of better
backtraces, and things like `try%lwt'. `let*' is nice for people
that don't want to use the PPX. They can still benefit from a
monadic syntax.
JOSE 0.3.0 - Now with 100% more encryption
══════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/ann-jose-0-3-0-now-with-100-more-encryption/5667/1]
Ulrik Strid announced
─────────────────────
I recently released a version 0.3.0 of JOSE.
[https://github.com/ulrikstrid/reason-jose]
[https://ulrikstrid.github.io/reason-jose]
It now includes some of the JWE (JSON Web Encryption) spec. A huge
thank you goes out to @hannes for helping me implementing one of the
gnarlier combinations of decryption that I could then use as a base
for encryption and more `alg' and `enc'.
I also refactored the JWK (JSON Web Keys) implementation to unify and
simplify the representation. It is now possible to use a private key
for anything a public key can do since it's a superset.
A special thanks to @anmonteiro for helping me with the design and
reviewing my code.
Are there learning materials for OCaml for those with no programming experience?
════════════════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/are-there-learning-materials-for-ocaml-for-those-with-no-programming-experience/5684/1]
Aaron Christianson asked
────────────────────────
OCaml is a language with some advanced features, but a very gentle
learning curve. It seems like it would be well-suited to teaching
beginners to program (a few tricky error messages notwithstanding),
but I haven't seen many resources targeted at teaching programming
from scratch. Does anyone here know any?
Daniel Bünzli replied
─────────────────────
There is [*OCaml from the Very Beginning*] written by @JohnWhitington.
[*OCaml from the Very Beginning*] http://ocaml-book.com/
Nicolás Ojeda Bär also replied
──────────────────────────────
An excellent (free) book is "LE LANGAGE CAML"
[https://caml.inria.fr/pub/distrib/books/llc.pdf].
Pierre also replied
───────────────────
There's also [CS3110] from Cornell University. Here's [the
textbook]. It's pretty great!
[CS3110] https://www.cs.cornell.edu/courses/cs3110/2020sp/
[the textbook]
https://www.cs.cornell.edu/courses/cs3110/2019sp/textbook/
The recent evolution of utop, lambda-term, zed and underneath projects
══════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/the-recent-evolution-of-utop-lambda-term-zed-and-underneath-projects/5687/1]
ZAN DoYe announced
──────────────────
Hi, dear OCaml guys! We've been keeping quiet for more than one year
though utop, lambda-term, zed and some related projects were still
evolving during the period of time. This is because of two reasons:
1. The new feature had nothing to do with the fields where most OCaml
developers are working on:
[https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/a/a30d5fb6fc075a50801b387299cc820965d48ca0.png]
[https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/9/91b88f0c492702212f00f17af1bf0e18ee1a463b.png]
Recognizing, editing, fuzzy searching for Character
Variation(mainly for ancient CJK characters).
Nevertheless, the new feature brought us a good side effect – the
long-existing [Issue with asian charset] was resolved. UTop users
will notice the refinement naturally, so no announcement was
needed.
2. I didn't deem the first few new editions of zed 2 and lambda-term 2
stable enough.
[Issue with asian charset]
https://github.com/ocaml-community/lambda-term/issues/2
3.0 era
╌╌╌╌╌╌╌
This time, we are entering zed 3, lambda-term 3 era. The features
introduced since zed 2, lambda-term 2 are quite stable now and the new
feature coming to us will have a bit more impact, especially to vim
users. So it's worthwhile to draft an announcement:
◊ VI Editing Mode
[https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/c/ca11924046977d89d4345ad135977c6960470edc.gif]
OCaml guys, hope you enjoy this.
List of notable changes:
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• zed 2:
• wide, combined glyph(Character Variation, IPA, CJK …)
• add wanted_column support for wide width character
• lambda-term 2:
• wide, combined glyph(Character Variation, IPA, CJK …)
• add horizontal scrolling support for wide width character
• zed 3:
• add new actions for convenience
• lambda-term 3:
• `LTerm_read_line': add initial support for vi editing mode:
• motions:
• h l 0 ^ $
• j k gg G
• w W e E b B ge gE
• f F t T
• aw iw aW iW
• include or inner ( ), [ ], { }, < >, ' and "
• generic quote: aq? iq? where ? could be any character
• bracket matching: jump back and forth between matched brackets
• delete, change, yank with motions
• paste: p P
• line joining: J
for a full list of the changes, please visit the homepages of each
project.
Projects underneath:
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• [charInfo_width]: Determine column width for a character
• [mew] & [mew_vi]: Modal editing witch & Its VI interpreter
complement. In a word, modal editing engine generators.
[charInfo_width] https://bitbucket.org/zandoye/charinfo_width/
[mew] https://github.com/kandu/mew
[mew_vi] https://github.com/kandu/mew_vi
What's next
╌╌╌╌╌╌╌╌╌╌╌
◊ VI Editing Mode
1. Visual mode
[https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/7/7cc45010710ad28d8d1e859e9b28806469ef8080.gif]
2. register support and more vi compatible
◊ CJKV
We've recorded more then 100 thousand entries about the structure of
CJK characters, what is a character consists of, how are the
sub-assemblies glue together etc. And as a complement to
charInfo_width, we may release a new project called charInfo_structure
;)
Looking for "lovely, idiomatic" examples of Ocaml used for shell-scripting in the manner of Perl/Python (but esp. Perl)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Archive:
[https://discuss.ocaml.org/t/looking-for-lovely-idiomatic-examples-of-ocaml-used-for-shell-scripting-in-the-manner-of-perl-python-but-esp-perl/5703/1]
Chet Murthy announced
─────────────────────
I wonder if there are people who have written nontrivial Ocaml code
for shell-scripting, that they think exemplifies the right way to do
it. I've been a Perl hacker for 25yr, and so when I reach for Ocaml
to write stuff that should be Perl shell-scripts, I always find it a
bit painful, and there's a significant overhead to getting the job
done. Some of that is applying ocaml to a new domain, but some of it
is that I'm just not using the right idioms and tools (and there are
so many to choose from).
So if anybody has good pointers, I'd appreciate learning about them.
Bikal Lem
─────────
Haven't tried it myself, but this looks promising …
[https://github.com/janestreet/shexp].
At least it has the great Sean Connery in its README so possibly worth
delving a bit. :)
Hezekiah Carty
──────────────
[bos] seems like it can do a lot of what you're looking for. It's at
least worth taking a look, though it may not be at Perl levels of
concise for this kind of task.
[bos] https://erratique.ch/software/bos
Martin Jambon
─────────────
I tried to summarize my take on the subject into this gist:
[https://gist.github.com/mjambon/bb07b24f89fa60c973735307ce9c6cb9]
I'm not aware of the existence of such tool, but this is how I might
design it. This should be reminiscent of camlp4's quotation and
anti-quotation system, which allows alternating between two syntaxes
within a source file.
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] mailto:alan.schmitt@polytechnique.org
[the archive] http://alan.petitepomme.net/cwn/
[RSS feed of the archives] http://alan.petitepomme.net/cwn/cwn.rss
[online] http://lists.idyll.org/listinfo/caml-news-weekly/
[Alan Schmitt] http://alan.petitepomme.net/
[-- Attachment #2: Type: text/html, Size: 28610 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-04-28 12:44 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-04-28 12:44 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 29726 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of April 21 to 28,
2020.
Table of Contents
─────────────────
opam 2.0.7 and 2.1.0 alpha
OCaml 4.11, release plan
ocamlformat pre-commit hook
New release of naboris 0.1.2
ANN: Releases of ringo
resto 0.2 released
Retrofitting Parallelism onto OCaml (research paper)
Multicore Update: April 2020, with a preprint paper
Why did Core remove polymorphic comparison operators in OCaml 4.10.0?
New release of js_of_ocaml 3.6.0
Other OCaml News
Old CWN
opam 2.0.7 and 2.1.0 alpha
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-opam-2-0-7-and-2-1-0-alpha/5583/1>
R. Boujbel announced
────────────────────
We are pleased to announce the release of [opam 2.0.7] and an [2.1.0
alpha].
This 2.0.7 version contains backported fixes, you can find more
information in this [blog post].
The 2.1.0~alpha contains many new features (cf. [blog post] or
[release note]). If you want to take a look, a few glitches or
regressions are expected, please report them to [the bug-tracker].
*opam is a source-based package manager for OCaml. It supports
multiple simultaneous compiler installations, flexible package
constraints, and a Git-friendly development workflow.*
[opam 2.0.7] <https://github.com/ocaml/opam/releases/tag/2.0.7>
[2.1.0 alpha] <https://github.com/ocaml/opam/releases/tag/2.1.0-alpha>
[blog post] <https://opam.ocaml.org/blog/opam-2-0-7>
[blog post] <https://opam.ocaml.org/blog/opam-2-1-0-alpha/>
[release note] <https://github.com/ocaml/opam/releases/tag/2.1.0-alpha>
[the bug-tracker] <https://github.com/ocaml/opam/issues>
Anil Madhavapeddy then added
────────────────────────────
Thanks for all the hard work that's gone into this release, @rjbou
@AltGr and @dra27!
To set expectations, this alpha release is for our users to smoke test
the new features and let us know if they work for your usecases.
In particular, the opam external dependency management and support for
recursive pins are both commonly requested features. Please do take
this alpha for a spin, and report feedback here on this thread.
After this alpha is cut, there will be a sequence of beta releases
(the number of which depend on the reported bug tail), and then the
final opam 2.1.0 release. Your testing _now_ will greatly help us put
a quality release out of the door.
OCaml 4.11, release plan
════════════════════════
Archive: <https://discuss.ocaml.org/t/ocaml-4-11-release-plan/5600/1>
octachron announced
───────────────────
The new version of OCaml, OCaml 4.11.0, has started its bugfix period:
the set of new features is now mostly frozen, and in the three
upcoming months, we will focus mostly on fixing bugs.
For this release cycle, we will experiment releasing an alpha version
of the compiler.
This new alpha version is expected to work as a synchronization point
for people working on updating the opam ecosystem for the new
release. Once the opam ecosystem is in shape for some wider audience
testings, we will publish a beta version as usual. This should be
happen around June.
One of the most notable change in this release is `Statmemprof', a new
statistical memory profiler directly integrated into the GC.
The provisional Changes list is [here].
At this point of time, it is better to take this list with a grain of
salt: there are a handful of new features that are still under
integration, problematic features might be removed, and of course the
list of bug fixes is incomplete.
But one of the most notable feature in this change log, `Statmemprof'
which a new statistical memory profiler API, is most probably here to
stay.
[here] <https://github.com/ocaml/ocaml/blob/4.11/Changes>
Guillaume Munch-Maccagnoni then added
─────────────────────────────────────
It should be mentioned that Memprof is documented as “~EXPERIMENTAL~”,
and at least one breaking change is being considered in 4.12. This
also mean that suggestion for improvement will be welcome (AFAIU).
ocamlformat pre-commit hook
═══════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-ocamlformat-pre-commit-hook/5602/1>
Brendan Long announced
──────────────────────
This is kind of trivial but I figured it might be useful for other
people. We created a hook config for using [ocamlformat] with
[pre-commit]:
<https://github.com/arenadotio/pre-commit-ocamlformat>
pre-commit is a tool that makes it easier to run checks on changed
files before commiting them, and this makes it so you can auto-run
ocamlformat and ensure no unformatted code gets into your repo.
1. [Install pre-commit] like `pip install pre-commit'
2. In your repo, add a .pre-commit-config.yaml like:
┌────
│ ---
│ repos:
│ - repo: https://github.com/arenadotio/pre-commit-ocamlformat
│ rev: master # or pick a commit sha I guess
│ hooks:
│ - id: ocamlformat
└────
1. Run `pre-commit install'
2. Now every time you run `git commit' (or `pre-commit run'), it will
run every staged OCaml file through ocamlformat and complain if
there are any changes:
┌────
│ $ pre-commit run ocamlformat
│ ocamlformat.....Failed
│ - hook id: ocamlformat
│ - files were modified by this hook
│ $ git add .
│ $ pre-commit run ocamlformat
│ ocamlformat.....Passed
└────
[ocamlformat] <https://github.com/ocaml-ppx/ocamlformat#ocamlformat>
[pre-commit] <https://pre-commit.com/>
[Install pre-commit] <https://pre-commit.com/#install>
New release of naboris 0.1.2
════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-new-release-of-naboris-0-1-2/5604/1>
Shawn McGinty announced
───────────────────────
Simple http server for OCaml/ReasonML.
[naboris] has been updated to 0.1.2
This release comes with a few improvements to the API but most notably
it has much better documentation at [naboris.dev]
[naboris] <https://naboris.dev>
[naboris.dev] <https://naboris.dev>
ANN: Releases of ringo
══════════════════════
Archive: <https://discuss.ocaml.org/t/ann-releases-of-ringo/5605/1>
Raphaël Proust announced
────────────────────────
On behalf of Nomadic Labs, I am please to announce the first few
releases of Ringo: a library for caches. Ringo offers two kinds of
caches: Maps for caches of key-value pairs and Sets for caches of
simple elements. In addition, each kind of cache can be tweaked to
handle their bounds differently.
Ringo versions 0.1, 0.2 and 0.3 are available on `opam'. As the
version number and the bundled announce suggests, this library is
still in early phases of release: additional replacement policies will
be added, the interface will probably change somewhat,
etc. Suggestions welcome!
Even though the interface is still in early phases of release, the
implementation is covered by a lot of tests and is already in use in
the Tezos project.
The code is available at <https://gitlab.com/nomadic-labs/ringo>
resto 0.2 released
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-resto-0-2-released/5028/3>
Raphaël Proust announced
────────────────────────
Release of `resto 0.5'
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
On behalf of Nomadic Labs, I'm happy to announce the release of
version 0.5 of `resto'.
The main change brought in this release are:
• relaxing of dependency bounds,
• documentation!
Retrofitting Parallelism onto OCaml (research paper)
════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/retrofitting-parallelism-onto-ocaml-research-paper/5628/1>
Guillaume Munch-Maccagnoni announced
────────────────────────────────────
The following paper on the multicore GC design by @kayceesrk and his
coauthors has been posted on arXiv today and might interest the
community: <https://arxiv.org/abs/2004.11663>
Multicore Update: April 2020, with a preprint paper
═══════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/multicore-update-april-2020-with-a-preprint-paper/5630/1>
Anil Madhavapeddy announced
───────────────────────────
Welcome to the April 2020 update from the Multicore OCaml team, across
the UK, India, France and Switzerland! Although most of us are in
lockdown, we continue to march forward. As with [previous updates],
thanks to @shakthimaan and @kayceesrk for help assembling it all.
[previous updates] <https://discuss.ocaml.org/tag/multicore-monthly>
◊ Preprint: Retrofitting Parallelism onto OCaml
We've put up a preprint of a paper titled ["Retrofitting Parallelism
onto OCaml" ] for which we would be grateful to receive feedback. The
paper lays out the problem space for the multicore extension of OCaml
and presents the design choices, implementation and evaluation of the
concurrent garbage collector (GC).
Note that this is *not a final paper* as it is currently under peer
review, so any feedback given now can still be incorporated. Please
use the e-mail contact details in the [pdf paper] for @kayceesrk and
myself so we can aggregate (and acknowledge!) any such comments.
["Retrofitting Parallelism onto OCaml" ]
<https://arxiv.org/abs/2004.11663>
[pdf paper] <https://arxiv.org/pdf/2004.11663.pdf>
◊ Rebasing Progress
The Multicore OCaml rebase from 4.06.1 has gained momentum. We have
successfully rebased the parallel-minor-GC all the way onto the [4.09
OCaml trees]. We will publish updated opam packages when we get to
the recently branched 4.11 in the next couple of weeks.
Rebasing complex features like this is a "slow and steady" process due
to the number of intermediate conflicts and bootstrapping, so we will
not be publishing opam packages for every intermediate version –
instead, the 4.11 trees will form the new "stable base" for any PRs.
[4.09 OCaml trees]
<https://github.com/ocaml-multicore/ocaml-multicore/tree/parallel_minor_gc_4_09>
◊ Higher-level Domainslib API
A thread from [last month's update] on building a parallel raytracer
led to some useful advancements in the [domainslib] library to provide
async/await-style task support. See the updates below for more
details.
There is also an interesting discussion on
[ocaml-multicore/ocaml-multicore#324] about how to go about profiling
and optimising your own small programs. More experiments with
parallel algorithms with different scheduling properties would be most
useful at this time.
[last month's update]
<https://discuss.ocaml.org/t/multicore-ocaml-march-2020-update/5406/8>
[domainslib] <https://github.com/ocaml-multicore/domainslib>
[ocaml-multicore/ocaml-multicore#324]
<https://github.com/ocaml-multicore/ocaml-multicore/issues/324>
◊ Upstreamed features in 4.11
The [4.11 release has recently branched] and has the following
multicore-relevant changes in it:
• A concurrency-safe marshalling implementation (originally in
[ocaml#9293], then implemented again in [ocaml#9353]). This will
have a slight speed hit to marshalling-heavy programs, so feedback
on trying this in your projects with 4.11 will be appreciated to the
upstream OCaml issue tracker.
• A runtime eventlog tracing system using the CTF format is on the
verge of being merged in 4.11 over in [ocaml#9082]. This will also
be of interest to those who need sequential program profiling, and
is a generalisation of the infrastructure that was essential to our
development of the multicore GC. If anyone is interested in helping
with hacking on the OCaml side of CTF support to build clients,
please get in touch with me or @kayceesrk.
In addition to the above highlights, we have also been making
continuous improvements and additions to the Sandmark benchmarking
test infrastructure. The various ongoing and completed tasks are
provided below for your reference.
[4.11 release has recently branched]
<https://discuss.ocaml.org/t/ocaml-4-11-release-plan/5600>
[ocaml#9293] <https://github.com/ocaml/ocaml/pull/9293>
[ocaml#9353] <https://github.com/ocaml/ocaml/pull/9353>
[ocaml#9082] <https://github.com/ocaml/ocaml/pull/9082>
Multicore OCaml
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
◊ Ongoing
• [ocaml-multicore/ocaml-multicore] Promote Multicore OCaml to trunk
The rebasing of Multicore OCaml from 4.06 to 4.10 is being worked,
and we are now at 4.09! In a few weeks, we expect to complete the
rebase to the latest trunk release.
• [ocaml-multicore/eventlog-tools]: OCaml Eventlog Tools
A project that provides a set of tools for runtime tracing for OCaml
4.11.0 and higher has been created. This includes a simple OCaml
decoder for eventlog's trace and a built-in chrome converter tool.
• [ocaml-multicore/domainslib#5] Add parallel_scan to domainslib
A [parallel_scan] implementation that uses the Task API with
prefix_sum and summed_area_table has now been added to the
Domain-level Parallel Programming library for Multicore OCaml
(domainslib) library.
[ocaml-multicore/ocaml-multicore]
<https://github.com/ocaml-multicore/ocaml-multicore/tree/parallel_minor_gc_4_09>
[ocaml-multicore/eventlog-tools]
<https://github.com/ocaml-multicore/eventlog-tools>
[ocaml-multicore/domainslib#5]
<https://github.com/ocaml-multicore/domainslib/pull/5>
[parallel_scan]
<https://en.wikipedia.org/wiki/Prefix_sum#Shared_memory:_Two-level_algorithm>
◊ Completed
The following PRs have been merged into Multicore OCaml and its
ecosystem projects:
• [ocaml-multicore/ocaml-multicore#328] Multicore compiler with
Flambda
Support for Flambda has been merged into the Multicore OCaml project
repository. The translation is now performed at cmmgen instead of
lambda for clambda conversion.
• [ocaml-multicore/ocaml-multicore#324] Optimizing a Multicore program
The following [documentation] provides a detailed example on how to
do performance debugging for a Multicore program to improve the
runtime performance.
• [ocaml-multicore/ocaml-multicore#325] Added eventlog_to_latencies.py
script
A script to generate a latency report from an eventlog has now been
included in the ocaml-multicore repository.
• [ocaml-multicore/domainslib#4] Add support for task_pools
The domainslib library now has support for work-stealing task pools
with async/await parallelism. You are encouraged to try the
[examples].
[ocaml-multicore/ocaml-multicore#328]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/328>
[ocaml-multicore/ocaml-multicore#324]
<https://github.com/ocaml-multicore/ocaml-multicore/issues/324>
[documentation]
<https://github.com/ocaml-multicore/ocaml-multicore/issues/324#issuecomment-610183856>
[ocaml-multicore/ocaml-multicore#325]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/325>
[ocaml-multicore/domainslib#4]
<https://github.com/ocaml-multicore/domainslib/pull/4>
[examples]
<https://github.com/ocaml-multicore/domainslib/tree/task_pool/test>
Benchmarking
╌╌╌╌╌╌╌╌╌╌╌╌
A number of new benchmarks are being ported to the [Sandmark]
performance benchmarking test suite.
• [ocaml-bench/sandmark#104] Added python pip3 dependency
A check_dependency function has now been defined in the Makefile
along with a list of dependencies and pip packages for Ubuntu. You
can now run `make depend' prior to building the benchmark suite to
ensure that you have the required software. The `python3-pip'
package has been added to the list of dependencies.
• [ocaml-bench/sandmark#96] Sandmark Analyze notebooks
The setup, builds and execution scripts for developer branches on
bench2.ocamllabs.io have been migrated to winter.ocamllabs.io.
A UI and automated script driven notebooks for analyzing sequential
bench results is being worked upon.
• [ocaml-bench/sandmark#108] Porting mergesort and matrix
multiplication using Task Pool API library
This is an on-going PR to implement merge sort and
matrix_multiplication using `parallel_for'.
• [cubicle]
`Cubicle' is a model checker and an automatic SMT theorem prover. At
present, it is being ported to Multicore OCaml, and this is a work
in progress.
• [raytracers]
Raytracers is a repository that contains ray tracer implementation
for different parallel functional programming languages. The OCaml
implementation has now been updated to use the new `Domainslib.Task'
API.
Also, a few [experiments] were performed on flambda parameters for
the Multicore raytracer which gives around 25% speedup, but it does
not yet remove the boxing of floats. The experiments are to be
repeated with a merge against the wip flambda2 trees on 4.11, that
removes float boxing.
[Sandmark] <https://github.com/ocaml-bench/sandmark>
[ocaml-bench/sandmark#104]
<https://github.com/ocaml-bench/sandmark/pull/104>
[ocaml-bench/sandmark#96]
<https://github.com/ocaml-bench/sandmark/issues/96>
[ocaml-bench/sandmark#108]
<https://github.com/ocaml-bench/sandmark/pull/108>
[cubicle] <https://github.com/Sudha247/cubicle/tree/add-multicore>
[raytracers] <https://github.com/athas/raytracers/pull/6>
[experiments]
<https://github.com/kayceesrk/raytracers/blob/flambda/ocaml/myocamlbuild.ml>
OCaml
╌╌╌╌╌
◊ Ongoing
• [ocaml/ocaml#9082] Eventlog tracing system
A substantial number of commits have gone into this PR based on
reviews and feedback. These include updates to the configure script,
handling warnings and exceptions, adding build support for Windows,
removing unused code and coding style changes. This patch will be
cherry-picked for the 4.11 release.
[ocaml/ocaml#9082] <https://github.com/ocaml/ocaml/pull/9082>
◊ Completed
• [ocaml/ocaml#9353] Reimplement `output_value' using a hash table to
detect sharing
This PR which implements a hash table and bit vector as required for
Multicore OCaml has been merged to 4.11.
Our thanks as always go to all the OCaml developers and users in the
community for their continued support, and contribution to the
project!
[ocaml/ocaml#9353] <https://github.com/ocaml/ocaml/pull/9353>
Acronyms
╌╌╌╌╌╌╌╌
• API: Application Programming Interface
• GC: Garbage Collector
• PIP: Pip Installs Python
• PR: Pull Request
• SMT: Satisfiability Modulo Theories
• UI: User Interface
Why did Core remove polymorphic comparison operators in OCaml 4.10.0?
═════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/why-did-core-remove-polymorphic-comparison-operators-in-ocaml-4-10-0/5633/1>
Trung Ta asked
──────────────
I'm using the Core library in a project, and recently when I upgraded
my OCaml from 4.08.1 to 4.10.0, plenty of compilation errors suddenly
appears for comparison expressions like:
`if (xs = []) then ...' or `if (x = true) then ...'
I saw that this change was discussed in this [thread] about
monomorphic comparison operators in Base, but did not expect that Core
would make it a default behavior.
So I'd like to ask since which version that Core removed such
polymorphic comparison operators? (I couldn't find it in release
notes of Core)
Also, if I defined a sum type like `type ternary = True | False |
Unkn', what will be a correct way to write `if (x = True) then ...'
(which is allowed in the new Core)?
I can temporarily fix by writing `if (x == True) then ...', but using
`==' doesn't seem correct, since `==' is about comparing physical
objects…
Thanks for spending your time to check my question.
[thread]
<https://discuss.ocaml.org/t/monomorphic-comparison-operator-of-janestreet-base-library/1585>
Aaron L. Zeng replied
─────────────────────
The change was announced in
<https://discuss.ocaml.org/t/ann-v0-13-release-of-jane-street-packages/4735>,
although unfortunately it doesn't look like the CHANGES.md file was
updated in the repo. I would consider the thread to be the canonical
announcement.
Also, if I defined a sum type like `type ternary = True |
False | Unkn' , what will be a correct way to write `if (x
= True) then ...' (which is allowed in the new Core)?
Here's a few suggestions:
1. Define equality/compare functions using [`ppx_compare']
┌────
│ type ternary = True | False | Unkn [@@deriving equal]
│
│ let f x = if (equal_ternary x True) then ...
└────
2. Define equality/compare functions manually
┌────
│ let equal_ternary t1 t2 =
│ match t1, t2 with
│ | True, True | False, False | Unkn, Unkn -> true
│ | _ -> false
└────
3. Explicitly request polymorphic comparison operators using the
`Poly' module:
┌────
│ let f x = if (Poly.(=) x True) then ...
└────
[`ppx_compare'] <https://github.com/janestreet/ppx_compare>
Trung said and Aaron L. Zeng replied
────────────────────────────────────
btw,
┌────
│ type ternary = True | False | Unkn [@@deriving equal]
└────
should be: `[@@deriving eq]'
That depends on which preprocessor you are using. `[@@deriving
equal]' comes from ppx_compare, whereas `[@@deriving eq]' comes from
[ppx_deriving]. Base/Core and the like have better support for the
former, which is a Jane Street project, although you can feel free to
use the latter—the naming conventions are different, so it may not be
as convenient.
[ppx_deriving] <https://github.com/ocaml-ppx/ppx_deriving>
New release of js_of_ocaml 3.6.0
════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-new-release-of-js-of-ocaml-3-6-0/5634/1>
Hhugo announced
───────────────
I'm pleased to announce the release [Js_of_ocaml] 3.6.0.
Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes
it possible to run pure OCaml programs in JavaScript environment like
browsers and Node.js.
Try it [online].
Notable changes:
• The `js_of_ocaml' compiler now accepts sub-commands (link,
build-runtime, build-fs, ..). The plan for future versions is to
remove other binary (e.g. jsoo_link) and consolidate everything
inside the `js_of_ocaml' binary itself.
• The standard JavaScript runtime is now embedded in the compiler
(findlib is no longer needed to locate it)
• Add support for the Str library (Regular expressions and high-level
string processing) shipped with the OCaml compiler
• Change memory representation of `Int64.t' (you might need to update
your JavaScript stubs)
• Many bug fixes (thanks to many more tests)
[Js_of_ocaml] <https://github.com/ocsigen/js_of_ocaml>
[online]
<https://ocsigen.org/js_of_ocaml/3.6.0/manual/files/toplevel/index.html>
Kirill Alexander Khalitov asked and Hhugo replied
─────────────────────────────────────────────────
1 Does the project have roadmap?
There is no official roadmap, the project evolves based on issues,
requests and contributions. You can take a look at some of the
[Github issues]
2 Is the project generally exists only for Ocsigen needs?
js_of_ocaml is used by various projects, not only Ocsigen. See
[Bonsai], [sketch-sh] or [jscoq] for instance.
3 Will it be adopted for modern front-end development
(commonjs/esmodules compatibility for working with
existing building tools ex. webpack, etc).
Being more friendly with the JavaScript ecosystem as been discussed
here and there in the past but little has been done, possibly by lack
of interest or use cases.
4 Does the project competing with bucklescript?
I don't think so. The two projects have different goals and different
audience. One of Js_of_ocaml main goal is to stay as close as possible
to the official OCaml semantic, allowing to leverage existing OCaml
libraries without any modification.
5 Why not to do ocaml to js compiler tools (based on
js_of_ocaml and bucklescript experience) that combine
possibility of using native ocaml and js libraries across
back-end and front-end like implemented in Scala.js/Fable
F#?
I don't understand this question. I would expect both js_of_ocaml and
bucklescript to be like Scala.js/Fable F# in their own way.
[Github issues]
<https://github.com/ocsigen/js_of_ocaml/issues?q=is:open+is:issue+label:enhancement>
[Bonsai] <https://github.com/janestreet/bonsai>
[sketch-sh] <https://github.com/Sketch-sh/sketch-sh>
[jscoq] <https://github.com/jscoq/jscoq>
Kirill Alexander Khalitov then said
───────────────────────────────────
I mean what Scala.js/Fable F# allows to use the most native libraries
(not all) and JS ones (from npm registry or from custom JS module) in
one project (ex. front-end). But in case of js_of_ocaml we limited to
native OCaml libs and "HTML scripts" (not JS compatible modules). For
bucklescript case we have whole JS ecosystem but have no access to
useful native libs from opam registry.
Xavier Van de Woestyne replied
──────────────────────────────
In Js_of_OCaml, you can deal with JavaScript's module (and npm/yarn),
using for example:
┌────
│ (* val require : string -> 'a *)
│ let require module_name =
│ let open Js.Unsafe in
│ fun_call
│ (js_expr "require")
│ [|inject (Js.string module_name)|]
└────
Other OCaml News
════════════════
>From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [Every proof assistant]
• [opam 2.0.7 release]
• [opam 2.1.0 alpha is here!]
[OCaml Planet] <http://ocaml.org/community/planet/>
[Every proof assistant]
<http://math.andrej.com/2020/04/28/every-theorem-prover/>
[opam 2.0.7 release]
<http://www.ocamlpro.com/2020/04/21/opam-2-0-7-release/>
[opam 2.1.0 alpha is here!]
<http://www.ocamlpro.com/2020/04/21/opam-2-1-0-alpha-is-here/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 47670 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-04-21 8:58 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-04-21 8:58 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 27263 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of April 14 to 21,
2020.
Table of Contents
─────────────────
Current_incr: a small incremental library with no dependencies
Scikit-learn for OCaml
OCaml and opam container images updated: new Fedora/Alpine/Ubuntu images
OCamlformat 0.14.0
Hashconsing an AST via PPX
Genprint v0.4
Other OCaml News
Old CWN
Current_incr: a small incremental library with no dependencies
══════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-current-incr-a-small-incremental-library-with-no-dependencies/5531/1>
Thomas Leonard announced
────────────────────────
The recent [OCurrent 0.2] release included a little incremental
library which might be interesting to some people. It is useful for
writing programs that need to keep some computation up-to-date
efficiently as the inputs change.
It is similar to the existing [incremental] and [react] libraries
already in opam. Unlike `incremental' (which pulls in the whole of
`core_kernel'), `current_incr' has no runtime dependencies (and build
dependencies only on `ocaml' and `dune'). Unlike `react',
`current_incr' immediately stops computations when they are no longer
needed (rather than relying on weak references and the garbage
collector).
It is a fairly direct implementation of the [Adaptive Functional
Programming] paper, and might be a good starting point for people
wanting to learn about that.
You can get the library using `opam':
┌────
│ opam install current_incr
└────
Here's a simple example (in utop):
┌────
│ #require "current_incr";;
│
│ let total = Current_incr.var 10
│ let complete = Current_incr.var 5
│
│ let status =
│ Current_incr.of_cc begin
│ Current_incr.read (Current_incr.of_var total) @@ function
│ | 0 -> Current_incr.write "No jobs"
│ | total ->
│ Current_incr.read (Current_incr.of_var complete) @@ fun complete ->
│ let frac = float_of_int complete /. float_of_int total in
│ Printf.sprintf "%d/%d jobs complete (%.1f%%)"
│ complete total (100. *. frac)
│ |> Current_incr.write
│ end
└────
This defines two input variables (`total' and `complete') and a
"changeable computation" (`status') whose output depends on them. At
the top-level, we can observe the initial state using `observe':
┌────
│ # print_endline @@ Current_incr.observe status;;
│ 5/10 jobs complete (50.0%)
└────
Unlike a plain `ref' cell, a `Current_incr.var' keeps track of which
computations depend on it. After changing them, you must call
`propagate' to update the results:
┌────
│ # Current_incr.change total 12;;
│ # Current_incr.change complete 4;;
│ # print_endline @@ Current_incr.observe status;;
│ 5/10 jobs complete (50.0%) (* Not yet updated *)
│
│ # Current_incr.propagate ();
│ # print_endline @@ Current_incr.observe status;;
│ 4/12 jobs complete (33.3%)
└────
Computations can have side-effects, and you can use `on_release' to
run some compensating action if the computation needs to be undone
later. Here's a function that publishes a result, and also registers a
compensation for it:
┌────
│ let publish msg =
│ Printf.printf "PUBLISH: %s\n%!" msg;
│ Current_incr.on_release @@ fun () ->
│ Printf.printf "RETRACT: %s\n%!" msg
└────
It can be used like this:
┌────
│ # let display = Current_incr.map publish status;;
│ PUBLISH: 4/12 jobs complete (33.3%)
│
│ # Current_incr.change total 0;
│ # Current_incr.propagate ()
│ RETRACT: 4/12 jobs complete (33.3%)
│ PUBLISH: No jobs
└────
A major difference between this and the react library (which I've used
in previously in [0install's progress reporting] and [CueKeeper]) is
that `Current_incr' does not depend on the garbage collector to decide
when to stop a computation. In react, you'd have to be careful to make
sure that `display' didn't get GC'd (even though you don't need to
refer to it again) because if it did then the output would stop
getting updated. Also, setting `total' to `0' in react might cause the
program to crash with a division-by-zero exception, because the `frac'
computation will continue running until it gets GC'd, even though it
isn't needed for anything now.
[`Current_incr''s API] is pretty small. You might want to wrap it to
provide extra features, e.g.
• Use of a `result' type to propagate errors.
• Integration with `Lwt' to allow asynchronous computations.
• Static analysis to render your computation with graphviz.
• Persistence of state to disk.
If you need that, consider using the main [OCurrent] library, which
extends `current_incr' with these features.
[OCurrent 0.2] <https://github.com/ocurrent/ocurrent/releases/tag/v0.2>
[incremental] <https://github.com/janestreet/incremental>
[react] <https://erratique.ch/software/react>
[Adaptive Functional Programming]
<https://www.cs.cmu.edu/~guyb/papers/popl02.pdf>
[0install's progress reporting]
<https://stackoverflow.com/questions/19975140/how-to-stop-ocaml-garbage-collecting-my-reactive-event-handler>
[CueKeeper]
<https://roscidus.com/blog/blog/2015/06/22/cuekeeper-internals-irmin/>
[`Current_incr''s API]
<https://ocurrent.github.io/ocurrent/current_incr/Current_incr/index.html>
[OCurrent] <https://github.com/ocurrent/ocurrent>
Scikit-learn for OCaml
══════════════════════
Archive: <https://discuss.ocaml.org/t/scikit-learn-for-ocaml/5536/1>
UnixJunkie announced
────────────────────
Ronan Lehy just hacked this:
<https://github.com/lehy/ocaml-sklearn>
This might interest a significant number of people out there. We are
no more condemned to live in a world full of snakes that will bite us
at run-time. :smiley:
Ronan Le Hy then said
─────────────────────
So I came here to announce ocaml-sklearn as it just got published on
Opam, but I see @UnixJunkie did it for me (arigato gozai
masu). Anyway:
• this ambitions to cover the complete scikit-learn API
• this ambition is currently not totally realized, but I wanted to
release something initial that one can play with
• it's all @UnixJunkie's fault with his funny R wrappers.
So:
• opam install sklearn
• go check out [scikit-learn and its awesome documentation] to know
what it does
• look at [ocaml-sklearn's documentation] to see what the current
OCaml API looks like
• have fun with it and tell me what you think of it.
[scikit-learn and its awesome documentation] <https://scikit-learn.org>
[ocaml-sklearn's documentation] <https://lehy.github.io/ocaml-sklearn/>
Anton Kochkov then added
────────────────────────
Probably worth to add here:
• <https://github.com/ocaml-community/awesome-ocaml#machine-learning>
OCaml and opam container images updated: new Fedora/Alpine/Ubuntu images
════════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-and-opam-container-images-updated-new-fedora-alpine-ubuntu-images/5539/1>
Anil Madhavapeddy announced
───────────────────────────
The Docker [ocaml and opam container images] have been updated:
• Alpine 3.11, Fedora 31 and Ubuntu 20.04 (beta) are now included.
• Ubuntu 19.04 and Fedora 29 and 30 are now deprecated.
• OCaml 4.09.1 and 4.11.0~dev have been refreshed.
You can find the full details of the container images available [on
the OCaml infrastructure wiki].
The containers are generated from a set of scripts using
[ocaml-dockerfile], and will be migrating over the next six months to
use an [ocurrent]-based infrastructure. There will be an announcement
on this forum about any user-facing changes that involves, with plenty
of time to transition your own CIs over. Thanks go to @talex5 and
@XVilka for contributions to this round of updates.
[ocaml and opam container images] <https://hub.docker.com/r/ocaml/opam2>
[on the OCaml infrastructure wiki]
<https://github.com/ocaml/infrastructure/wiki/Containers>
[ocaml-dockerfile] <https://github.com/avsm/ocaml-dockerfile>
[ocurrent] <https://ocurrent.org>
OCamlformat 0.14.0
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-ocamlformat-0-14-0/5435/24>
Jules announced
───────────────
As Etienne mentioned, we have released OCamlformat 0.14.1, reverting
the change to the defaults and our plans to deprecate the
`doc-comments' option.
For projects that already upgraded to 0.14.0 (eg. Coq), the
`doc-comments' option will change its meaning again. It is necessary
to add `doc-comments=before' to have the documentation comments placed
before. Moreover, the new option `doc-comments-val' added in 0.14.0
has a higher precedence than `doc-comments', even when it's not
set. It is thus necessary to set them both to `before' to have the old
"before" behavior. This will be improved in the next release (see
<https://github.com/ocaml-ppx/ocamlformat/pull/1340>).
Thank you to our early adopters to bear us. We are improving our
release process to reduce confusion for the next updates. As usual, if
you have any feedback, please open an issue on
<https://github.com/ocaml-ppx/ocamlformat> to discuss it with us.
Hashconsing an AST via PPX
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/hashconsing-an-ast-via-ppx/5558/1>
Chet Murthy announced
─────────────────────
[up-front (so nobody gets the wrong idea): I'm not pushing Camlp5.
Rather, I'm just noting that this sort of thing is really easy to do,
and I encourage someone to do something similar using the PPX
infrastructure.]
I didn't want to derail the "Future of PPX" thread, so I thought I'd
post separately to answer ivg@ 's issue about hashconsing of ASTs
using PPX. It's actually [uh, I think] really, really easy to
implement hashconsing of ADTs, using a PPX extension. On a lark, I
decided to do it *today*, and while the code I've got isn't sufficient
to use, I think it's not very far away, and I have the perfect
use-case already in-mind. It took me two hours to implement the
rewriter and the testcase, on top of the other infrastructure, which
has no support for hashconsing of any sort.
Here are some examples of data-types and functions that are
automaticaly hash-consed. The idea is that in the pattern-match the
pattern is annotated with a variable (in this example, "z"); the
expression that is supposed to be hash-consed against that pattern is
annotated with that same variable. [The code that descends to the
expression is a little weak right now, but I think that's easily
fixable.] The algorithm goes as follows:
(1) "decorate" the pattern with "as z_<integer>" variables everywhere
in constructors. This allows us to refer to parts of the original
value.
(2) then find each expression that is marked with that same varable.
Structurally descend the pattern and the expression in parallel and
generate code to compare sub-structure and hashcons where appropriate.
And that's really it. I'm sure this can be implemented using the PPX
tools.
Some comments: (1) what's nice, is that we can just take
already-written code like `List.map' and annotate it; that generates a
hash-consed version. And since the generated code never uses deep
structural equality (only pointer-equality) it should be only
marginally slower than the original implementation.
(2) The variable in the annotation ("z") is used as the base for
generating a whole slew of fresh variables, and I don't bother (yet)
to check for clashes; this (again) is straightforward, but hey, I
started two hours ago.
┌────
│ type t = Leaf of int | Node of t * int * t
│
│ module HCList = struct
│
│ let rec map f = function
│ [][@hashrecons z] -> [][@hashrecons z]
│ | (a::l)[@hashrecons z] -> let r = f a in ((r :: map f l)[@hashrecons z])
│
│ end
│
│ let deep =
│ let rec deep = (function
│ Leaf n[@hashrecons z] -> Leaf n[@hashrecons z]
│ | Node (l, n, r) [@hashrecons z] ->
│ Node (deep l, n, deep r) [@hashrecons z]
│ )
│ [@@ocaml.warning "-26"]
│ in deep
│
│ type sexp =
│ | Atom of string
│ | List of sexp list
│
│ let sexp_deep =
│ let rec deep = function
│ Atom s[@hashrecons z] -> Atom s[@hashrecons z]
│ | List l[@hashrecons z] -> List (HCList.map deep l)[@hashrecons z]
│ in deep
└────
Links: First, at the commit, so they won't change
the testcase file:
<https://github.com/chetmurthy/pa_ppx/commit/5dd6b2ef3ca3677e11a0ad696074200101bd661f#diff-e6dffe78fc6c27bdffa41970c4a7f1ca>
the "ppx rewriter":
<https://github.com/chetmurthy/pa_ppx/commit/5dd6b2ef3ca3677e11a0ad696074200101bd661f#diff-24aeaf51366017948f5735727f001c85>
Second, the files with human-readable names, etc.:
the testcase:
<https://github.com/chetmurthy/pa_ppx/blob/master/tests/test_hashrecons.ml>
the "ppx rewriter":
<https://github.com/chetmurthy/pa_ppx/blob/master/pa_hashrecons/pa_hashrecons.ml>
The projects:
chetmurthy/pa_ppx: A reimplementation of ppx_deriving, all its
plugins, ppx_import, and a few others.
<https://github.com/chetmurthy/pa_ppx>
chetmurthy/camlp5: Camlp5, version pre-8.00 on which the above is
based. This is on the branch 26.attempt-pa-deriving .
Kakadu said
───────────
I experimented with this some time ago for ML workshop. The idea was
to provide function: `t -> htbl -> htbl * t' which rewrites value of
type `t' by removing equal subtrees. Essentially it is just a fold
over data type.
<https://github.com/kakadu/GT/blob/master/regression/test816hash.ml#L74>
Chet Murthy asked and Josh Berdine replied
──────────────────────────────────────────
If you wanna use a hashtable (and, I presume, Obj.magic)
you can write a single function that does the trick for
all immutable data-types, right?
Yes, we have some magic @mbouaziz [code] in Infer that does this to
create as much sharing as possible as values are Marshaled out.
[code]
<https://github.com/facebook/infer/blob/master/infer/src/istd/MaximumSharing.ml>
Genprint v0.4
═════════════
Archive: <https://discuss.ocaml.org/t/ann-genprint-v0-4/5575/1>
progman announced
─────────────────
A re-announcement of Genprint, a general value printing library, that
addresses prior limitations that made it none too useful!
1. It didn't work correctly for 4.08.0, the latest compiler release as
of first announcement (though fine for 4.02 .. 4.07.1)
2. There was an awkward need to specify a search path for .cmt files
when working with the likes of Dune (which uses separate
directories for source, .cmi and (for opt) .cmt files)
3. More often than not values of interest would display simply as
`<abstr>' owing to the presence of signature abstraction of the
module's type of interest.
These issues have been addressed:
1. Works with versions 4.04 .. 4.10.0 (earlier versions became invalid
after a dependency change to ppxlib)
2. The location of .cmt files is captured automatically by the PPX
preprocessor.
3. Signatures at the implementation level (.mli files) and internally
(functor application constraints) are removed to reveal the inner
structure of otherwise abstract values. For instance, the
Ephemeron module:
┌────
│ module EM=Ephemeron.K1.Make(struct type t=int let equal=(=) let hash=Hashtbl.hash end)
│ open EM
│ let _=
│ let v=EM.create 0 in
│ EM.add v 12345678 'X';
│ let emprint ppf (v: Obj.Ephemeron.t) =
│ Format.fprintf ppf "<C wrapper of key/data>" in
│ [%install_printer emprint];
│ [%pr ephem v];
└────
Which prints:
┌────
│ ephem => {size = 1;
│ data =
│ [|Empty; Empty; Empty; Empty; Empty; Empty; Empty; Empty; Empty;
│ Empty; Empty; Cons (922381915, <C wrapper of key/data>, Empty);
│ Empty; Empty; Empty; Empty|];
│ seed = 0; initial_size = 16}
└────
This also demos the [%install_printer] facility which mirrors the
REPL's.
Installation is via the Opam main repository.
Additionally, the project repository [contains] two compiler versions
of _ocamldebug_ integrated with the Genprint library which thereby
becomes its default printer.
All of which makes this library much more useful than previously. See
the [project page] for the details.
[contains]
<https://github.com/progman1/genprintlib/tree/master/debugger>
[project page] <https://github.com/progman1/genprintlib>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Editor note: Thanks to [ezcurl], I can restore this section. I'm
putting all the links this week, I will prune to only put the new ones
next week.
Here are links from many OCaml blogs aggregated at [OCaml Planet].
• [An in-depth Look at OCaml’s new “Best-fit” Garbage Collector
Strategy]
• [Sliding Tile Puzzle, Self-Contained OCaml Webapp]
• [New version of Try OCaml in beta!]
• [Frama-Clang 0.0.8 is out. Download it here.]
• [A reasonable TyXML release | Drup's thingies]
• [Alt-Ergo Users’ Club Annual Meeting]
• [OCaml iOS Apps Ported to Browser]
• [Watch all of Jane Street's tech talks]
• [Mercurial: prettyconfig extension]
• [Mercurial extensions (update)]
• [2019 at OCamlPro]
• [Bitbucket repository migration]
• [Troubleshooting systemd with SystemTap]
• [Ocsigen Start updated]
• [Ocsigen Start updated]
• [opam 2.0.6 release]
• [opam 2.0.6 release]
• [Hackers and climate activists join forces in Leipzig]
• [Deploying authoritative OCaml-DNS servers as MirageOS unikernels]
• [Reproducible MirageOS unikernel builds]
• [Using Python and OCaml in the same Jupyter notebook]
• [Coq 8.11+beta1 is out]
• [Deep-Learning the Hardest Go Problem in the World]
• [Frama-C 20.0 (Calcium) is out. Download it here.]
• [Testing OCaml releases with opamcheck]
• [Coq 8.10.2 is out]
• [Announcing Irmin 2.0.0]
• [BAP 2.0 is released]
• [CI/CD pipelines: Monad, Arrow or Dart?]
• [On fixed-point theorems in synthetic computability]
• [Runners in action]
• [Coq 8.10.1 is out]
• [Announcing MirageOS 3.6.0]
• [Commas in big numbers everywhere: An OpenType adventure]
• [Coq 8.10.0 is out]
• [OCaml expert and beginner training by OCamlPro (in French):
Nov. 5-6 & 7-8]
• [Mr. MIME - Parse and generate emails]
• [A look back on OCaml since 2011]
• [Frama-C 19.1 (Potassium) is out. Download ithere.]
• [Coq 8.10+beta3 is out]
• [Updated Cheat Sheets: OCaml Language and OCaml Standard Library]
• [Frama-Clang 0.0.7 is out. Download ithere.]
• [Decompress: Experiences with OCaml optimization]
• [On complete ordered fields]
• [An introduction to fuzzing OCaml with AFL, Crowbar and Bun]
• [What is algebraic about algebraic effects?]
• [The blog moved from Wordpress to Jekyll]
• [OCamlPro’s compiler team work update]
• [What the interns have wrought, 2019 edition]
• [Decompress: The New Decompress API]
[ezcurl] <https://github.com/c-cube/ezcurl>
[OCaml Planet] <http://ocaml.org/community/planet/>
[An in-depth Look at OCaml’s new “Best-fit” Garbage Collector Strategy]
<http://www.ocamlpro.com/2020/03/23/ocaml-new-best-fit-garbage-collector/>
[Sliding Tile Puzzle, Self-Contained OCaml Webapp]
<http://psellos.com/2020/03/2020.03.how-i-wrote-elastic-man.html>
[New version of Try OCaml in beta!]
<http://www.ocamlpro.com/2020/03/16/new-version-of-try-ocaml-in-beta/>
[Frama-Clang 0.0.8 is out. Download it here.]
<http://frama-c.com/index.html>
[A reasonable TyXML release | Drup's thingies]
<https://drup.github.io/2020/03/06/tyxml440/>
[Alt-Ergo Users’ Club Annual Meeting]
<http://www.ocamlpro.com/2020/03/03/alt-ergo-userss-club-annual-meeting/>
[OCaml iOS Apps Ported to Browser]
<http://psellos.com/2020/02/2020.02.kid-charlemagne.html>
[Watch all of Jane Street's tech talks]
<https://blog.janestreet.com/watch-all-of-jane-streets-tech-talks/>
[Mercurial: prettyconfig extension]
<http://blog.0branch.com/posts/2020-02-15-prettyconfig-extension.html>
[Mercurial extensions (update)]
<http://blog.0branch.com/posts/2020-02-05-hg-extensions.html>
[2019 at OCamlPro]
<http://www.ocamlpro.com/2020/02/04/2019-at-ocamlpro/>
[Bitbucket repository migration]
<http://blog.0branch.com/posts/2020-02-03-bitbucket-migration.html>
[Troubleshooting systemd with SystemTap]
<https://blog.janestreet.com/troubleshooting-systemd-with-systemtap/>
[Ocsigen Start updated]
<https://ocsigen.github.io/blog/2020/01/20/release/>
[opam 2.0.6 release]
<http://www.ocamlpro.com/2020/01/16/opam-2-0-6-release/>
[opam 2.0.6 release] <https://opam.ocaml.org/blog/opam-2-0-6/>
[Hackers and climate activists join forces in Leipzig]
<https://mirage.io/blog/ccc-2019-leipzig>
[Deploying authoritative OCaml-DNS servers as MirageOS unikernels]
<https://hannes.nqsb.io/Posts/DnsServer>
[Reproducible MirageOS unikernel builds]
<https://hannes.nqsb.io/Posts/ReproducibleOPAM>
[Using Python and OCaml in the same Jupyter notebook]
<https://blog.janestreet.com/using-python-and-ocaml-in-the-same-jupyter-notebook/>
[Coq 8.11+beta1 is out]
<https://coq.inria.fr/news/coq-8-11beta1-is-out.html>
[Deep-Learning the Hardest Go Problem in the World]
<https://blog.janestreet.com/deep-learning-the-hardest-go-problem-in-the-world/>
[Frama-C 20.0 (Calcium) is out. Download it here.]
<http://frama-c.com/index.html>
[Testing OCaml releases with opamcheck]
<http://gallium.inria.fr/blog/an-ocaml-release-story-1>
[Coq 8.10.2 is out] <https://coq.inria.fr/news/coq-8-10-2-is-out.html>
[Announcing Irmin 2.0.0] <https://mirage.io/blog/introducing-irmin-v2>
[BAP 2.0 is released]
<http://binaryanalysisplatform.github.io/bap-2-release>
[CI/CD pipelines: Monad, Arrow or Dart?]
<https://roscidus.com/blog/blog/2019/11/14/cicd-pipelines/>
[On fixed-point theorems in synthetic computability]
<http://math.andrej.com/2019/11/07/on-fixed-point-theorems-in-synthetic-computability/>
[Runners in action]
<http://math.andrej.com/2019/10/28/runners-in-action/>
[Coq 8.10.1 is out] <https://coq.inria.fr/news/coq-8-10-1-is-out.html>
[Announcing MirageOS 3.6.0]
<https://mirage.io/blog/announcing-mirage-36-release>
[Commas in big numbers everywhere: An OpenType adventure]
<https://blog.janestreet.com/commas-in-big-numbers-everywhere/>
[Coq 8.10.0 is out] <https://coq.inria.fr/news/coq-8-10-0-is-out.html>
[OCaml expert and beginner training by OCamlPro (in French): Nov. 5-6 &
7-8]
<http://www.ocamlpro.com/2019/09/25/ocaml-expert-and-beginner-training-by-ocamlpro-in-french-nov-5-6-7-8/>
[Mr. MIME - Parse and generate emails]
<https://tarides.com/blog/2019-09-25-mr-mime-parse-and-generate-emails.html>
[A look back on OCaml since 2011]
<http://www.ocamlpro.com/2019/09/20/a-look-back-on-ocaml/>
[Frama-C 19.1 (Potassium) is out. Download ithere.]
<http://frama-c.com/index.html>
[Coq 8.10+beta3 is out]
<https://coq.inria.fr/news/coq-8-10beta3-is-out.html>
[Updated Cheat Sheets: OCaml Language and OCaml Standard Library]
<http://www.ocamlpro.com/2019/09/13/updated-cheat-sheets-ocaml-language-and-ocaml-standard-library/>
[Frama-Clang 0.0.7 is out. Download ithere.]
<http://frama-c.com/index.html>
[Decompress: Experiences with OCaml optimization]
<https://tarides.com/blog/2019-09-13-decompress-experiences-with-ocaml-optimization.html>
[On complete ordered fields]
<http://math.andrej.com/2019/09/09/on-complete-ordered-fields/>
[An introduction to fuzzing OCaml with AFL, Crowbar and Bun]
<https://tarides.com/blog/2019-09-04-an-introduction-to-fuzzing-ocaml-with-afl-crowbar-and-bun.html>
[What is algebraic about algebraic effects?]
<http://math.andrej.com/2019/09/03/what-is-algebraic-about-algebraic-effects/>
[The blog moved from Wordpress to Jekyll]
<http://math.andrej.com/2019/09/03/the-blog-moved-from-wordpress-to-jekyll/>
[OCamlPro’s compiler team work update]
<http://www.ocamlpro.com/2019/08/30/ocamlpros-compiler-team-work-update/>
[What the interns have wrought, 2019 edition]
<https://blog.janestreet.com/what-the-interns-have-wrought-2019/>
[Decompress: The New Decompress API]
<https://tarides.com/blog/2019-08-26-decompress-the-new-decompress-api.html>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 47059 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-04-14 7:28 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-04-14 7:28 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 8637 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of April 07 to 14,
2020.
Table of Contents
─────────────────
Announcing dune-deps: produces a project-centric dependency graph
OCamlformat 0.14.0
Dune 2.5.0
Old CWN
Announcing dune-deps: produces a project-centric dependency graph
═════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/announcing-dune-deps-produces-a-project-centric-dependency-graph/5451/3>
Martin Jambon announced
───────────────────────
Since the original announcement, I received some good feedback from
users working on large projects. Thank you!
The latest version released today is 1.2.0. It is already available on
opam-repository (thank you @kit-ty-kate). The changes since the
original release, besides bug fixes, include:
• Ability to select or ignore dune files and folders to scan. For
example, `dune-deps foo bar -x bar/test' uses all the dune files
found in folders `foo' and `bar' but will ignore `bar/test'. This is
useful for ignoring uninteresting parts of the project and for
ignoring parse errors (see bug [#4]).
• Executable name disambiguation. For example, private executables of
the same name like `foo/main' and `bar/baz/main' are now rendered as
`main<foo>' and `main<baz>' respectively instead of just `main'.
• Optional exclusion of all executables or all external libraries with
`--no-exe' and `--no-ext'.
• Ability to show only the dependencies and/or the reverse
dependencies of selected libraries. See below.
Whole-project graphs for large projects tend to be unreadable. To deal
with that, I added support for an "hourglass view" (⌛) option for
showing only the dependencies and reverse dependencies of a component
of interest.
The following is obtained with `-h opam-client' on the opam project:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/6/66098faac9fd6681e3c0f4fe357aef8ff34bcaf2.png>
Please [let us know] if this works for your favorite projects! The
source code of dune-deps makes it somewhat easier now to experiment
with new strategies for eliminating nodes. See the `Filter' and
`Filterable' modules.
Check out `dune-deps --help' for detailed documentation on the
options.
[#4] <https://github.com/mjambon/dune-deps/issues/4>
[let us know] <https://github.com/mjambon/dune-deps/issues>
Sean Grove said and Martin Jambon replied
─────────────────────────────────────────
That’s a nice idea - it’d be great to have this available
as a GitHub action so anyone could do this with just a
click or two!
So, I made a [generic yaml workflow] that people can stick into their
git/github project. This will automatically maintain the dependency
graph `.deps/deps.png' which can be included in a readme.
[generic yaml workflow] <https://github.com/mjambon/dune-deps-action>
OCamlformat 0.14.0
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-ocamlformat-0-14-0/5435/21>
Etienne Millon announced
────────────────────────
As described in this thread, ocamlformat 0.14.0 introduced a new
algorithm to determine how documentation comments are placed. We
underestimated the impact of making this the default, and this means
that many unwanted diffs were present for 0.13.0 -> 0.14.0 upgrades.
We are going to prepare a 0.14.1 release next week reverting this
behavior back to the 0.13.0 defaults. Users still on 0.13.0 are
encouraged to wait for this and upgrade directly to 0.14.1.
Sorry for the inconvenience, and thanks for the feedback!
Dune 2.5.0
══════════
Archive: <https://discuss.ocaml.org/t/ann-dune-2-5-0/5494/1>
Rudi Grinberg announced
───────────────────────
The dune team is pleased to announce the release of dune 2.5.0. This
release has been brewing for a while and contains a few interesting
features. I'll highlight some of the bigger ones:
• The coq support has been thoroughly extended. There's now support
for both composition of coq libraries in the same workspace and
extraction of coq code to OCaml.
• There's a new `$ dune upgrade' subcommand to help you upgrade dune
files from 1.x to 2.x
• `$ dune utop' will now load ppx preprocessors to the toplevel. Ppx
authors might enjoy this style of interactive development.
• There's a new `(subdir ..)' stanza that can be used to evaluate
stanzas in sub directories. This makes it possible to have a single
dune file for an entire project (generated or not).
I'd like to thank everyone who contributed to dune 2.5.0. Your help is
greatly appreciated.
Here's the full change log:
2.5.0 (09/04/2020)
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Add a `--release' option meaning the same as `-p' but without the
package filtering. This is useful for custom `dune' invocation in
opam files where we don't want `-p' (#3260, @diml)
• Fix a bug introduced in 2.4.0 causing `.bc' programs to be built
with `-custom' by default (#3269, fixes #3262, @diml)
• Allow contexts to be defined with local switches in workspace files
(#3265, fix #3264, @rgrinberg)
• Delay expansion errors until the rule is used to build something
(#3261, fix #3252, @rgrinberg, @diml)
• [coq] Support for theory dependencies and compositional builds using
new field `(theories ...)' (#2053, @ejgallego, @rgrinberg)
• From now on, each version of a syntax extension must be explicitely
tied to a minimum version of the dune language. Inconsistent
versions in a `dune-project' will trigger a warning for version
<=2.4 and an error for versions >2.4 of the dune language. (#3270,
fixes #2957, @voodoos)
• [coq] Bump coq lang version to 0.2. New coq features presented this
release require this version of the coq lang. (#3283, @ejgallego)
• Prevent installation of public executables disabled using the
`enabled_if' field. Installation will now simply skip such
executables instead of raising an error. (#3195, @voodoos)
• `dune upgrade' will now try to upgrade projects using versions <2.0
to version 2.0 of the dune language. (#3174, @voodoos)
• Add a `top' command to integrate dune with any toplevel, not just
utop. It is meant to be used with the new `#use_output' directive of
OCaml 4.11 (#2952, @mbernat, @diml)
• Allow per-package `version' in generated `opam' files (#3287,
@toots)
• [coq] Introduce the `coq.extraction' stanza. It can be used to
extract OCaml sources (#3299, fixes #2178, @rgrinberg)
• Load ppx rewriters in dune utop and add pps field to toplevel
stanza. Ppx extensions will now be usable in the toplevel (#3266,
fixes #346, @stephanieyou)
• Add a `(subdir ..)' stanza to allow evaluating stanzas in sub
directories. (#3268, @rgrinberg)
• Fix a bug preventing one from running inline tests in multiple modes
(#3352, @diml)
• Allow the use of the `%{profile}' variable in the `enabled_if' field
of the library stanza. (#3344, @mrmr1993)
• Allow the use of `%{ocaml_version}' variable in `enabled_if' field
of the library stanza. (#3339, @voodoos)
• Fix dune build freezing on MacOS when cache is enabled. (#3249,
fixes ##2973, @artempyanykh)
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 20312 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-04-07 7:51 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-04-07 7:51 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 26459 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 31 to April
07, 2020.
Table of Contents
─────────────────
Making a music player in OCaml
The end of Camlp4
OCamlformat 0.14.0
ML Family Workshop 2020: Call for presentations
Announcing Sek, an efficient implementation of sequences
Announcing dune-deps: produces a project-centric dependency graph
OCaml Users and Developers Meeting 2020
Old CWN
Making a music player in OCaml
══════════════════════════════
Archive:
<https://discuss.ocaml.org/t/making-a-music-player-in-ocaml/5413/1>
Dracose asked
─────────────
I'm interested in making my own music player in OCaml so I wanted to
know whether there were any existing ones and/or examples of how to
make one. Bear in mind, I am interested in the actual logic of how to
read a music file (or a playlist) and listening to it, rather than the
front-end part of a music player. (My knowledge of OCaml is
intermediate)
Thomas Blanc suggested
──────────────────────
You want to check <https://github.com/savonet/liquidsoap>
Yotam Barnoy then said
──────────────────────
Wow @PatJ I didn't know about liquidsoap. I added it to
ocamlverse. This is what we have for the audio page now, in case it's
helpful to the OP: <https://ocamlverse.github.io/content/audio.html>
gndl also replied
─────────────────
I experimented with several solutions in the [playo] project. One of
the possible solutions is to use [ocaml-gstreamer]. If you find that
the gstreamer framework is too annoying (which I can understand :-),
you can use [ocaml-ffmpeg]. note however that, in the latest version
of ocaml-ffmpeg, the audio device output [no longer works]. To
overcome this drawback, you can use [ocaml-portaudio].
[playo] <https://github.com/gndl/playo>
[ocaml-gstreamer] <https://github.com/savonet/ocaml-gstreamer>
[ocaml-ffmpeg] <https://github.com/savonet/ocaml-ffmpeg>
[no longer works] <https://github.com/savonet/ocaml-ffmpeg/issues/32>
[ocaml-portaudio] <https://github.com/savonet/ocaml-portaudio>
The end of Camlp4
═════════════════
Archive: <https://discuss.ocaml.org/t/the-end-of-camlp4/4216/96>
Continuing this old thread, Chet Murthy announced
─────────────────────────────────────────────────
Perhaps worth mentioning briefly that for anybody who -wants- to
continue using camlp4, I'm (a) maintaining camlp5 and bringing it
up-to-date with everything in ocaml 4.10.0 that I can think of, and
(b) I'd be happy to help them port their dependency over to camlp5.
This is not to be construed as an argument for using camlp4/5.
OCamlformat 0.14.0
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-ocamlformat-0-14-0/5435/1>
Etienne Millon announced
────────────────────────
On behalf of the development team, I'd like to announce the release of
ocamlformat version 0.14.0 :tada:.
Here are the main highlights of this release:
Support for OCaml 4.10
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
This means both that it compiles and runs using this version, but also
that it can format 4.10-specific language features (`module _' and
multi-indices operators).
Preliminary support for invalid files
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
As OCamlformat operates on ASTs, it normally requires a valid input
file. This release adds a `--format-invalid-files' option to detect
invalid parts and print them verbatim. This feature is still
experimental.
Preserving more concrete syntax
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Starting with this release, OCamlformat is going to preserve more
concrete syntax. For example, `module M = functor (K : S) -> struct
end' and `module M (K : S) = struct end' are equivalent. In the past,
both variants would be formatted as the latter. Now, the original
syntax is preserved. In some cases, preserving was possible through
the means of an option: for example, to choice between `let%name x = e
in body' and `[%name let x = e in body]', was controlled by the
`extension-sugar' option. This option is now deprecated and
OCamlformat will now always preserve what was in the source file (this
was the default behaviour).
Similarly, it was possible to control how special characters are
escaped in string and character literals through the `escape-strings'
and `escape-chars' options. They are being deprecated and the only
possible behavior will be preserving the concrete syntax (as done by
default).
The reason for this change is that we feel that ocamlformat should be
just about formatting. The fact that this behavior was configurable is
in part due to the fact that it operates on OCaml ASTs, but end users
should not have to be surprised by their code being transformed on
reformatting.
In the future, we plan to extend that to other similar constructs,
such as using `(~/')~ or `begin~/~end', or spacing between module
items.
Placement of doc comments
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Placing doc comments `(** ... *)' is controlled by the `doc-comments'
configuration option. It is always possible to put them before the
item they refer to, and this is what the `doc-comments=before' option
does. The alternative `doc-comments=after' will try to do its best to
put them after, but in some cases it is not possible. For example, in
a variant type declaration, a doc-comment put immediately after will
be attached to the last constructor by documentation
tools. Ocamlformat needs to preserve the meaning of programs, so in
these cases, it will instead put the comment before. In the case of
`module' declarations, putting the comment after might not be very
useful if the corresponding module is very large.
This requires a complex rule to determine which comments will be put
before and which comments will be put after. So in this version, we
are deprecating this mechanism and replacing it with a simpler one
controlled by `doc-comments-val' that applies only to `val' and
`external' items. For these items, it is always possible to attach
documents before or after them. For all other items, like type or
module declarations, the doc comments will consistenly be put before.
Many bugs found by fuzzing
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
We hooked ocamlformat to AFL, looking for programs that parse
correctly but trigger errors during formatting. This approach worked
very well and more than 20 logical bugs were found with this
technique.
Upgrading
╌╌╌╌╌╌╌╌╌
To upgrade from ocamlformat 0.13.0, one needs to upgrade the
ocamlformat binary and replace the `version' field in `.ocamlformat'
files by `0.14.0' and then:
• if you used `doc-comments=after', you can replace it by
`doc-comments-val=after'. This will move doc-comments on module
items except `val' and `external' ones.
• if you used `doc-comments=before', you can remove it as it is now
the default.
• if you set `escape-chars=preserve', `escape-strings=preserve', or
`extension-sugar=preserve' explicitly, you can
remove them safely (they were the default)
• if you used another value for one of these options (such as
`escape-strings=hexadecimal'), you will need to remove them as
well. This will not trigger a diff, but ocamlformat will not enforce
a particular concrete syntax for new code.
A note for new users
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
We encourage you to try ocamlformat, that can be installed from opam
directly (`opam install ocamlformat'), but please remember that it is
still beta software. We added a [FAQ for new users] that should help
you decide if ocamlformat is the right choice for you.
[FAQ for new users]
<https://github.com/ocaml-ppx/ocamlformat#faq-for-new-users>
Etienne Millon later added
──────────────────────────
This upgrade is likely to generate a huge diff on projects that use
the default profile, so I would like to expand a bit on the reason.
According to [the syntax rules used by the ocaml tools] (the ocaml
compilers, ocamldoc, odoc), it is always possible to put the
doc-comment before an item.
Some teams prefer to put the documentation after. But that is not
always possible. For example, `type t = A | B (** doc *)' will attach
the doc-comment to `B', not to `t'. The only way to attach the comment
to `t' is by putting the comment before.
Enter ocamlformat: doc-comment placement is controlled by an option
with two values, `before' or `after'. `before' will always place the
comment before. `after' determines if it is possible to put the
comment after, and if it is not, will put it before.
Some items cannot have comments after, like variant types (as
described above). But there is another reason not to put comments
after. In some cases, that can put the comment far from the thing it
is documenting. Considering modules, the following is nice:
┌────
│ module M = L.M
│ (** doc *)
└────
But this is not great is the structure is large:
┌────
│ module M = struct
│ ...
│ ...
│ end
│ (** doc *)
└────
To summarize, when ocamlformat is configured to put comments after, it
has to follow a complex heuristic to determine whether it has to
fallback to before. In the case of a module, it depends on its shape,
how many functor arguments are there, this kind of things (for various
reasons, we don't know how large something is going to be in advance,
so we have to look at its shape). The point is that it is complicated
to understand and explain, and that fixing it always makes it more
complex. Another aspect is that in the end, we want ocamlformat to be
pretty stable when it reaches 1.0.0, and complex rules are at odds
with this goal.
So, we have decided to simplify the rule: instead of looking deep in
the AST, we just look at the kind of item this is. For `val' and
`external' items, it is always possible to put the doc-comment after,
so we follow exactly what the configuration option says.
As a user of the default profile, what this means for you: for items
that are not `val' or `external', and considered "simple" by the
0.13.0 heuristic, doc-comments are going to move from after to before.
Based on these reasons, you will understand that `before' is always
simpler. You can opt into this by setting
`doc-comments-val=before'. This will cause an even larger diff as all
items are going to move before (that is: all items described just
above, plus `val' and `external' items), but the rule gets extremely
simple (everything is put before). It is possible that this option
will become the default in the future, but we have not decided this
yet (in this case, if you did not opt into it, you will see comments
on `val' and `external' items move at that time).
[the syntax rules used by the ocaml tools]
<https://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html#ss:ocamldoc-placement>
ML Family Workshop 2020: Call for presentations
═══════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ml-family-workshop-2020-call-for-presentations/5441/1>
Leo White announced
───────────────────
We are happy to invite submissions to the ML Family Workshop 2020, to
be held during the ICFP conference week on Thursday, August 27th.
The ML family workshop warmly welcomes submission touching on the
programming languages traditionally seen as part of the "ML family"
(Standard ML, OCaml, F#, CakeML, SML#, Manticore, MetaOCaml,
etc.). The scope of the workshop includes all aspects of the design,
semantics, theory, application, implementation, and teaching of the
members of the ML family. We also encourage presentations from related
languages (such as Haskell, Scala, Rust, Nemerle, Links, Koka, F*,
Eff, ATS, etc), to exchange experience of further developing ML ideas.
Currently, the workshop is still scheduled to go ahead as planned in
Jersey City, however it is likely that the ML workshop will end up
being a virtual workshop this year. Either way provisions will be made
to allow speakers to present their work remotely.
See our detailed CFP online on the ICFP website:
<https://icfp20.sigplan.org/home/mlfamilyworkshop-2020>
Important dates
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Friday 15th May (any time zone): Abstract submission deadline
• Friday 26th June: Author notification
• Thursday 27th August: ML Family Workshop
Program committee
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Youyou Cong (Tokyo Institute of Technology)
• Gowtham Kaki (Purdue University)
• Neel Krishnaswami (University of Cambridge)
• Daan Leijen (Microsoft Research)
• Koko Muroya (Kyoto University)
• Atsushi Ohori (Tohoku University)
• Jonathan Protzenko (Microsoft Research)
• Gabriel Radanne (INRIA)
• Claudio Russo (Dfinity)
• Leo White (Jane Street) (Chair)
• Jeremy Yallop (University of Cambridge)
Submission details
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
See the online CFP for the details on the expected submission format.
Submissions must be uploaded to the workshop submission website
<https://ml2020.hotcrp.com/>
before the submission deadline.
Announcing Sek, an efficient implementation of sequences
════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/announcing-sek-an-efficient-implementation-of-sequences/5442/1>
François Pottier announced
──────────────────────────
We are pleased to announce the first release of Sek, an OCaml library
that offers an efficient implementation of sequences.
The library offers both ephemeral (mutable) sequences and persistent
(immutable) sequences, and offers constant-time conversions between
these flavors.
It supports all of the standard operations on stacks, queues, deques
(e.g. push, pop at either end), catenable sequences (concat, split),
and random access sequences (get, set).
Data is stored internally in chunks (fixed-capacity arrays), which is
why this data structure is known as a chunK SEquence.
It is intended to achieve excellent time complexity and memory usage.
This is an initial release. The library has not been tested in
production, but has received extensive unit testing, via afl-fuzz and
ocaml+afl – which are remarkably effective tools, by the way!
This is work in progress; more features, such as iterators, will be
added in the future.
To install Sek, just type
┌────
│ opam update && opam install sek
└────
Documentation is [online].
Feedback is welcome!
Arthur Charguéraud
François Pottier
with contributions by Émilie Guermeur
[online] <http://cambium.inria.fr/~fpottier/sek/doc/sek/Sek/index.html>
Yaron Minsky asked and Fabian replied
─────────────────────────────────────
I’m particularly interested in how it compares to
Base.Sequence and Seq in the OCaml distribution, but
surely there are others as well.
This actually looks like an array/vector structure (supporting, among
other things, fast access to the nth element), so a comparison with
`CCVector', `CCFun_vec', `BatVect', `Clarity.Vector' etc. would be
more appropriate. The name is a bit unfortunate considering the naming
used in the general ecosystem.
Some time ago, I added some crude benchmarks to [containers'
benchsuite]. I'll see if I can add Sek when I find time.
[containers' benchsuite]
<https://github.com/c-cube/ocaml-containers/blob/d34b7588b028f3618cc44d3f4c6417295db586c8/benchs/run_benchs.ml#L112>
gasche said
───────────
I think it really is a sequence library in the sense that in maintains
an in-order sequence of items, and sequences can be joined/split
efficiently. It also provides logarithmic random access, but this is
probably not competitive with fixed-size arrays. It would be
comparable to "persistent vector" libraries, ropes, finger trees,
etc. The fact that the authors expose a Stack/Queue interface suggests
that it has also been tuned to perform reasonably well in this case.
It does not provide any delayed computation of items, so in that
regard it is not comparable to Sequence/Seq.
@charguer has designed similar datastructures in the past to represent
the work-queues of concurrent workers (you want at least a fast "push"
to add a new task and, when doing work-stealing, having a fast "split"
is convenient). See [Theory and Practice of Chunked Sequences], Umut
Acar, Arthur Charguéraud, Mike Rainey, 2014, and [A Work-Efficient
Algorithm for Parallel Unordered Depth-First Search].
As far as I know, the OCaml implementation just released has not been
tested/benchmarked for parallel algorithms. I would be curious to see
an experiment of parallel graph traversal with this structure and
Multicore-OCaml.
[Theory and Practice of Chunked Sequences]
<https://www.chargueraud.org/research/2014/chunkedseq/chunkedseq.pdf>
[A Work-Efficient Algorithm for Parallel Unordered Depth-First Search]
<https://www.chargueraud.org/research/2015/pdfs/pdfs_sc15.pdf>
Announcing dune-deps: produces a project-centric dependency graph
═════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/announcing-dune-deps-produces-a-project-centric-dependency-graph/5451/1>
Martin Jambon announced
───────────────────────
I'm happy to announce the availability of [dune-deps], a command-line
tool that scans a dune project and gathers the dependencies into a
graph. The output is in the dot format, supported by the `dot' command
from [graphviz].
It shows the dependencies between the following:
• libraries defined by the project,
• executables defined by the project,
• direct dependencies on external libraries.
Dependencies are extracted by parsing `dune' files. As an example,
here's what we obtain for the [sources of opam], which has over 50K
lines of code:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/f/f6213fa7fda52521c6782988155ab23b997dafb8.png>
The commands for this are:
┌────
│ # obtain the project's sources
│ $ git clone --depth=1 https://github.com/ocaml/opam.git
│
│ # extract dependencies and eliminate superfluous graph edges
│ $ dune-deps opam | tred > deps.dot
│
│ # render the graph
│ $ dot -Tpng deps.dot -o deps.png
└────
A suggestion is to include such graph in your project's `README.md'.
[dune-deps] <https://github.com/mjambon/dune-deps>
[graphviz] <https://www.graphviz.org/>
[sources of opam] <https://github.com/ocaml/opam>
OCaml Users and Developers Meeting 2020
═══════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ocaml-users-and-developers-meeting-2020/5454/1>
Ivan Gotovchits announced
─────────────────────────
It is my pleasure to invite submissions to the OCaml Users and
Developers Workshop 2020, which is again co-located with ICFP and will
be held on Friday 28th August 2020 in Jersey City, NJ, USA.
The OCaml Users and Developers Workshop brings together the OCaml
community, including users of OCaml in industry, academia, hobbyists
and the free software community. Previous editions have been
co-located with ICFP since 2012 in Copenhagen, Boston, Gothenburg,
Nara, Oxford, St Louis and last year in Berlin, following OCaml
Meetings in Paris in 2010 and 2011.
Important Links
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• <https://ocaml.org/meetings/ocaml/2020/>
• <https://icfp20.sigplan.org/home/ocaml-2020>
• <https://ocaml2020.hotcrp.com/>
Important Dates
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Talk proposal submission deadline: May 8th, 2020, AoE
• Author Notification: June 26th, 2020
• OCaml Workshop: August 28th, 2020
Scope
╌╌╌╌╌
Presentations and discussions focus on the OCaml programming language
and its community. We aim to solicit talks on all aspects related to
improving the use or development of the language and its programming
environment, including, for example (but not limited to):
• compiler developments, new backends, runtime and architectures
• practical type system improvements, such as GADTs, first-class
modules, generic programming, or dependent types
• new library or application releases, and their design rationales
• tools and infrastructure services, and their enhancements
• prominent industrial or experimental uses of OCaml, or deployments
in unusual situations.
Presentations
╌╌╌╌╌╌╌╌╌╌╌╌╌
The workshop is an informal meeting with no formal proceedings. The
presentation material will be available online from the workshop
homepage. The presentations may be recorded and made available at a
later date.
The main presentation format is a workshop talk, traditionally around
20 minutes in length, plus question time, but we also have a poster
session during the workshop – this allows to present more diverse
work, and gives time for discussion. The program committee will decide
which presentations should be delivered as posters or talks.
Submission
╌╌╌╌╌╌╌╌╌╌
To submit a presentation, please register a description of the talk
(about 2 pages long) at
<https://ocaml2020.hotcrp.com/>
providing a clear statement of what will be provided by the
presentation: the problems that are addressed, the solutions or
methods that are proposed.
LaTeX-produced PDFs are a common and welcome submission format. For
accessibility purposes, we ask PDF submitters to also provide the
sources of their submission in a textual format, such as .tex
sources. Reviewers may read either the submitted PDF or the text
version.
ML family workshop
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The ML family workshop, held on the previous day, deals with general
issues of the ML-style programming and type systems, focuses on more
research-oriented work that is less specific to a language in
particular. There is an overlap between the two workshops, and we have
occasionally transferred presentations from one to the other in the
past. Authors who feel their submission fits both workshops are
encouraged to mention it at submission time and/or contact the Program
Chairs.
Program Committee
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• Ivan Gotovchits, CMU, USA
• Florian Angeletti, INRIA, France
• Chris Casinghino, Draper Laboratory, USA
• Catherine Gasnier, Facebook, USA
• Rudi Grinberg, OCaml Labs, UK
• Oleg Kiselyov, Tohoku University, Japan
• Andreas Rossberg, Dfinity Stiftung, Germany
• Marcello Seri, University of Groningen, Netherlands
• Edwin Torok, Citrix, UK
• Leo White, Jane Street, USA
• Greta Yorsh, Jane Street, USA
• Sarah Zennou, Airbus, France
COVID-19 Notice
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
While ICFP-20 [is still scheduled to be held as planned], chances are
high that it will be turned into a virtual conference. Which means a
wider audience and reduced (hopefully) fees. We will keep you posted.
[is still scheduled to be held as planned]
<https://icfp20.sigplan.org/home/icfp-2020>
Questions and contact
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Please send any questions to the chair: Ivan Gotovchits (ivg@ieee.org)
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 42475 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-03-31 9:54 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-03-31 9:54 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 30045 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 24 to 31,
2020.
Table of Contents
─────────────────
An In-Depth Look at OCaml’s New “Best-Fit” Garbage Collector Strategy
First release of Pp, a pretty-printing library
soupault: a static website generator based on HTML rewriting
routes: path based routing for web applications
Compiler Engineer at Mixtional Code in Darmstadt or anywhere else in Germany
tiny-httpd 0.5
Visual Studio Code plugin for OCaml
Dismas: a tool for automatically making cross-versions of opam packages
Multicore OCaml: March 2020 update
Old CWN
An In-Depth Look at OCaml’s New “Best-Fit” Garbage Collector Strategy
═════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/an-in-depth-look-at-ocaml-s-new-best-fit-garbage-collector-strategy/5370/1>
OCamlPro announced
──────────────────
The Garbage Collector is probably OCaml’s greatest unsung hero. Its
pragmatic approach allows us to allocate without much fear of
efficiency loss. We looked into its new "Best-fit" strategy and here
is what we learned!
[http://www.ocamlpro.com/2020/03/23/ocaml-new-best-fit-garbage-collector/]
[http://www.ocamlpro.com/2020/03/23/ocaml-new-best-fit-garbage-collector/]
<http://www.ocamlpro.com/2020/03/23/ocaml-new-best-fit-garbage-collector/>
First release of Pp, a pretty-printing library
══════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-pp-a-pretty-printing-library/5371/1>
Jérémie Dimino announced
────────────────────────
I'm happy to announce the first release of the [pp library]! This
library provides a lean alternative to the [Format module] of the
standard library. It uses the same comcepts of boxes and break hints,
however it defines its own algebra which some might find easier to
work with and reason about. I personally do :) The final rendering is
still done via a formatter which makes it easy to integrate `Pp' in
existing programs using `Format'.
We introduced this module in [Dune] to help improve the formatting of
messages printed in the terminal and it has been a success. The new
API is smaller, simpler and makes it easy for developers to do the
right thing. Once the `Pp' module of Dune was mature enough, we
decided to extract it into a separate library so that it could benefit
others.
The library itself is composed of a single `Pp' module and has no
dependencies. Its documentation is self-contained and no previous
knowledge is required to start using it, however the various guides
for the `Format' module such as [this one] should be applicable to
`Pp' as well.
If you have used `Format' before and like me found its API complicated
and difficult to use, I hope that you will find `Pp' nicer to work
with!
[pp library] <https://github.com/diml/pp>
[Format module]
<https://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html>
[Dune] <https://dune.build>
[this one] <http://caml.inria.fr/resources/doc/guides/format.en.html>
Josh Berdine then said
──────────────────────
Another great resource for understanding the core mental model of
Format is [Format Unraveled], although if I understand pp correctly
the discussion about Format not being document-based won't apply to
pp.
[Format Unraveled]
<https://hal.archives-ouvertes.fr/hal-01503081/file/format-unraveled.pdf>
soupault: a static website generator based on HTML rewriting
════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-soupault-a-static-website-generator-based-on-html-rewriting/4126/13>
Daniil Baturin announced
────────────────────────
[1.10.0] release is available.
Bug fixes:
• Files without extensions are handled correctly.
New features:
• Plugin discovery: if you save a plugin to `plugins/my-plugin.lua',
it's automatically loaded as a widget named
`my-plugin'. List of plugin directories is configurable.
• New plugin API functions: `HTMLget_tag_name', `HTML.select_any_of',
`HTML.select_all_of'.
• The `HTML' module is now "monadic": giving a nil to a function that
expects an element gives you a nil back, rather than cause a runtime
error.
[1.10.0] <https://soupault.neocities.org/blog/soupault-1.10-release>
routes: path based routing for web applications
═══════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-routes-path-based-routing-for-web-applications/3624/6>
Anurag Soni announced
─────────────────────
[0.7.2] release is now available on opam. There have been quite a few
changes since the previous versions.
• Routes doesn't deal with HTTP methods anymore
• The internal implementation is now based around a trie like data
structure
• Routes have pretty printers
• sprintf style route printing is supported again
• Minimum supported OCaml version is now 4.05 (it used to be 4.06)
• There is a release available for bucklescript as well and it is
available to install via [npm].
[0.7.2] <http://opam.ocaml.org/packages/routes/>
[npm] <https://www.npmjs.com/package/@anuragsoni/routes>
Compiler Engineer at Mixtional Code in Darmstadt or anywhere else in Germany
════════════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/compiler-engineer-at-mixtional-code-in-darmstadt-or-anywhere-else-in-germany/5377/1>
Gerd Stolpmann announced
────────────────────────
Type of position:
• regular hire (no freelancers)
• full time
• work from home anywhere in Germany, or in the office in Darmstadt
• work for a small and highly skilled international team, located in
the US and Europe
• the team language is English
We are developing a compiler for a no-code platform that translates
our DSL to bytecode and/or WebAssembly. The language is largely of
functional type but is also able to manage state with a spreadsheet
model, allowing reactive programming without having to resort to
libraries. The language is statically typed using a Hindley-Milner
type checker. The compiler is primarily written in OCaml. Other
languages of our platform are Go, Elm, and Javascript.
We are looking for a compiler engineer with strong skills in all
relevant areas:
• fluent in OCaml or a similar language such as Haskell
• Understanding of the structure of the DSL, including syntax and
semantics
• Translation of FP languages to executable code
• Code optimization
• Graph algorithms
• Type checking
We are open to both juniors and seniors, and payment will be
accordingly. We are not so much interested in formal certifications
but rather in real practice, either from previous jobs, research
projects, or contributions to open source projects.
The no-code platform is being developed by engineers in Europe and the
US at various places, and we usually do not meet physically but in
video conferences. Working from home is very usual. We also get you a
desk in your home town if you prefer this. The compiler development is
lead by Gerd Stolpmann from Darmstadt.
Due to the strong connections to the US, video conferences will often
have to take place in evening hours, until around 7pm or 8pm.
Applications: please follow the "Apply" link at the official web page
describing the position: <https://rmx.mixtional.de/static/54657cda/>
Gerd Stolpmann
CEO of Mixtional Code GmbH (and OCaml hacker of the first hour)
Contact and company details: <https://www.mixtional.de/contact.html>
Sébastien Besnier asked
───────────────────────
I'm living in France, can I apply to the position (we are neighbors!)?
Gerd Stolpmann replied
──────────────────────
Well, I can (at the moment) only make contracts using German law and
for the social security system here. So, if you need a doctor you'd
have to travel… If my company was a bit bigger there would be the
option of opening a second site in France (even a very minimal one),
but the setup costs are so far too high (lawyers and accountants), and
it is too distracting for me to keep up with the fine points of the
system in France. Unfortunately, the EU is not that far that it is
super simple for an employer to hire anywhere in Europe. - Thanks for
asking.
tiny-httpd 0.5
══════════════
Archive: <https://discuss.ocaml.org/t/ann-tiny-httpd-0-5/5381/1>
Simon Cruanes announced
───────────────────────
I just released tiny-httpd 0.5 and the new tiny-httpd-camlzip, which
makes it possible to use `deflate' transparently for queries and
responses. The server has evolved quietly and is getting somewhat more
robust: I'm using it for an internal tool with big html pages (up to
several MB) and it's reasonably fast and doesn't seem to
memleak. There's also an improved `http_of_dir' to quickly and simply
serve a directory on an arbitrary port.
Previous announcement [here]
[here] <https://discuss.ocaml.org/t/ann-tiny-httpd-0-1/4727>
Visual Studio Code plugin for OCaml
═══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-preview-visual-studio-code-plugin-for-ocaml/5395/1>
Rudi Grinberg announced
───────────────────────
I'm proud to announce a preview release of an [VSC extension for
OCaml]. You can fetch and install this plugin directly from the
extension marketplace if you search for "OCaml Labs". The extension
isn't yet mature, but I believe that it offers a user experience
comparable to other VSC extensions for OCaml already. The plugin
should be used in conjunction with [ocaml-lsp]
The extension is for the OCaml "platform", which means that its scope
includes support for various tools used in OCaml development such as
dune, opam.
Bug reports & contributions are welcome. Happy hacking.
[VSC extension for OCaml]
<https://github.com/ocamllabs/vscode-ocaml-platform>
[ocaml-lsp] <https://github.com/ocaml/ocaml-lsp>
Dismas: a tool for automatically making cross-versions of opam packages
═══════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-prototype-dismas-a-tool-for-automatically-making-cross-versions-of-opam-packages/5404/1>
Daniil Baturin announced
────────────────────────
opam-cross-* are seriously lagging behind the official opam repository
and fdopen's opam-windows, not least because importing packages by
hand is a lot of work. I suppose at least a semi-automated process
could help those repos grow and stay in sync with the upstream much
faster.
I've made a prototype of a tool for "stealing" packages into
cross-repos. For obvious reasons it's called Dismas. You can find it
here: <https://github.com/dmbaturin/scripts/blob/master/dismas.ml>
Limitations:
• the code is a real mess for now
• only dune is supported by automatic build command adjustment
• it cannot handle cases when both native and cross-version of a
dependency are needed
However:
• For simple packages that use dune exclusively, it's completely
automated. I've ported bigstreamaf and angstrom to test it, and
cross-versions built just fine from its output, no editing was
needed.
• It automatically converts dependencies from foo to too-$toolchain
and removes dependencies and build steps only
needed for `with-test' and `with-doc'.
┌────
│ $ ./dismas.ml windows containers ~/devel/opam-repository/packages/containers/containers.2.8.1/opam
│ opam-version: "2.0"
│ maintainer: "simon.cruanes.2007@m4x.org"
│ synopsis:
│ "A modular, clean and powerful extension of the OCaml standard library"
│ build: [
│ ["dune" "build" "-p" "containers" "-j" jobs "-x" "windows"]
│ ]
│ depends: [
│ "ocaml-windows" {>= "4.03.0"}
│ "dune" {>= "1.1"}
│ "dune-configurator"
│ "seq-windows"
│ ]
│ depopts: ["base-unix" "base-threads"]
│ tags: ["stdlib" "containers" "iterators" "list" "heap" "queue"]
│ homepage: "https://github.com/c-cube/ocaml-containers/"
│ doc: "https://c-cube.github.io/ocaml-containers"
│ dev-repo: "git+https://github.com/c-cube/ocaml-containers.git"
│ bug-reports: "https://github.com/c-cube/ocaml-containers/issues/"
│ authors: "Simon Cruanes"
│ url {
│ src: "https://github.com/c-cube/ocaml-containers/archive/v2.8.1.tar.gz"
│ checksum: [
│ "md5=d84e09c5d0abc501aa17cd502e31a038"
│ "sha512=8b832f4ada6035e80d81be0cfb7bdffb695ec67d465ed6097a144019e2b8a8f909095e78019c3da2d8181cc3cd730cd48f7519e87d3162442562103b7f36aabb"
│ ]
│ }
│
│ $ ./dismas.ml windows containers ~/devel/opam-repository/packages/containers/containers.2.8.1/opam | diff
│ ~/devel/opam-repository/packages/containers/containers.2.8.1/opam -
│ 3c3,4
│ < synopsis: "A modular, clean and powerful extension of the OCaml standard library"
│ ---
│ > synopsis:
│ > "A modular, clean and powerful extension of the OCaml standard library"
│ 5,7c6
│ < ["dune" "build" "-p" name "-j" jobs]
│ < ["dune" "build" "@doc" "-p" name ] {with-doc}
│ < ["dune" "runtest" "-p" name "-j" jobs] {with-test}
│ ---
│ > ["dune" "build" "-p" "containers" "-j" jobs "-x" "windows"]
│ 10,11c9,10
│ < "ocaml" { >= "4.03.0" }
│ < "dune" { >= "1.1" }
│ ---
│ > "ocaml-windows" {>= "4.03.0"}
│ > "dune" {>= "1.1"}
│ 13,21c12
│ < "seq"
│ < "qtest" { with-test }
│ < "qcheck" { with-test }
│ < "ounit" { with-test }
│ < "iter" { with-test }
│ < "gen" { with-test }
│ < "uutf" { with-test }
│ < "mdx" { with-test & >= "1.5.0" & < "2.0.0" }
│ < "odoc" { with-doc }
│ ---
│ > "seq-windows"
│ 23,27c14,15
│ < depopts: [
│ < "base-unix"
│ < "base-threads"
│ < ]
│ < tags: [ "stdlib" "containers" "iterators" "list" "heap" "queue" ]
│ ---
│ > depopts: ["base-unix" "base-threads"]
│ > tags: ["stdlib" "containers" "iterators" "list" "heap" "queue"]
└────
Things to do:
• identify all packages that don't need cross-versions. Is cppo one of
them, for example?
• add support for cases when both native and cross versions are
needed. If menhir the only one?
• add support for other build systems. Do all of them work well with
`OCAMLFIND_TOOLCHAIN=windows` if the build setup is written
correctly?
Input from @toots and @pirbo is welcome.
Romain Beauxis then said
────────────────────────
That's a great initiative! Here are a couple of thoughts:
• For dune-based packages, things are indeed pretty
straight-forward. Finding out which dependencies need to be ported
as cross-dependency is indeed the part that's hard to automatize
• For other build systems, it's less clear to me how to
automatize. Maybe others have some thoughts about it.
• The CI system on opam-cross-windows is pretty good at building from
scratch and failing if some deps are missing so trial and error
there can be a great tool.
• Once solved for one cross situation, the problem of
cross-dependencies should be exactly the same for all other cross
environment (android, iOS)
I haven't looked at the tool very closely yet but I'd say a first
improvement would be to be able to track cross-dependencies resolution
and generate new version of the package using them and/or generate
other cross-compiled packages using them.
Anton Kochkov said
──────────────────
For automated pull requests, you might be interested in
<https://discuss.ocaml.org/t/dependabot-and-ocaml/4282>
Daniil Baturin then asked
─────────────────────────
I'm not sure if I understand the premise of dependabot. Why would
anyone hardcode specific dependency versions? Maybe it makes sense in
certain ecosystems that suffer from never-ending ecological disasters…
;)
In any case, most opam packages don't have a constraint on the upper
versions of their dependencies. Can dependabot use custom tracking
rules to check for presense of a newer version in the repo? My
thought was much simpler actually: track the commits in
opam-repository, run recently changed files through Dismas and send
pull requests to opam-cross-*
Yawar Amin replied
──────────────────
It's common practice nowadays to use semantic versioning and have
lockfiles for reproducible builds. Dependabot updates semantic version
ranges and lockfiles. See e.g.
• <https://github.com/thoughtbot/velveteen/pull/31/files>
• <https://github.com/mozilla/adr/pull/77/files>
Multicore OCaml: March 2020 update
══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/multicore-ocaml-march-2020-update/5406/1>
Anil Madhavapeddy announced
───────────────────────────
Welcome to the March 2020 news update from the Multicore OCaml team!
This update has been assembled with @shakthimaan and @kayceesrk, as
with the [February] and [January] ones.
Our work this month was primarily focused on performance improvements
to the Multicore OCaml compiler and runtime, as part of a
comprehensive evaluation exercise. We continue to add additional
benchmarks to the Sandmark test suite. The eventlog tracing system and
the use of hash tables for marshaling in upstream OCaml are in
progress, and more PRs are being queued up for OCaml 4.11.0-dev as
well.
The biggest observable change for users trying the branch is that a
new GC (the "parallel minor gc") has been merged in preference to the
previous one ("the concurrent minor gc"). We will have the details in
longer form at a later stage, but the essential gist is that *the
parallel minor GC no longer requires a read barrier or changes to the
C API*. It may have slightly worse scalability properties at a very
high number of cores, but is roughly equivalent at up to 24 cores in
our evaluations. Given the vast usability improvement from not having
to port existing C FFI uses, we have decided to make the parallel
minor GC the default one for our first upstream runtime patches. The
concurrent minor GC follow at a later stage when we ramp up testing to
64-core+ machines. The [multicore opam remote] has been updated to
reflect these changes, for those who wish to try it out at home.
We are now at a stage where we are porting larger applications to
multicore. Thanks go to:
• @UnixJunkie who helped us integrate the Gram Matrix benchmark in
<https://github.com/ocaml-bench/sandmark/issues/99>
• @jhw has done extensive work towards supporting Systhreads in
<https://github.com/ocaml-multicore/ocaml-multicore/pull/240>. Systhreads
is currently disabled in multicore, leading to some popular packages
not compiling.
• @antron has been advising us on how best to port `Lwt_preemptive`
and the `Lwt_unix` modules to multicore, giving us a widely used IO
stack to test more applications against.
If you do have other suggestions for application that you think might
provide useful benchmarks, then please do get in touch with myself or
@kayceesrk.
Onto the details! The various ongoing and completed tasks for
Multicore OCaml are listed first, which is followed by the changes to
the Sandmark benchmarking infrastructure and ongoing PRs to upstream
OCaml.
[February]
<https://discuss.ocaml.org/t/multicore-ocaml-feb-2020-update/5227>
[January]
<https://discuss.ocaml.org/t/multicore-ocaml-january-2020-update/5090>
[multicore opam remote]
<https://github.com/ocaml-multicore/multicore-opam>
Multicore OCaml
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
◊ Ongoing
• [ocaml-multicore/ocaml-multicore#240] Proposed implementation of
threads in terms of Domain and Atomic
A new implementation of the `Threads` library for use with the new
`Domain` and `Atomic` modules in Multicore OCaml has been
proposed. This builds Dune 2.4.0 which in turn makes it useful to
build other packages. This PR is open for review.
• [ocaml-multicore/safepoints-cmm-mach] Better safe points for OCaml
A newer implementation to insert safe points at the Cmm level is
being worked upon in this branch.
[ocaml-multicore/ocaml-multicore#240]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/240>
[ocaml-multicore/safepoints-cmm-mach]
<https://github.com/anmolsahoo25/ocaml-multicore/tree/safepoints-cmm-mach>
◊ Completed
The following PRs have been merged into Multicore OCaml:
• [ocaml-multicore/ocaml-multicore#303] Account correctly for
incremental mark budget
The patch correctly measures the incremental mark budget value, and
improves the maximum latency for the `menhir.ocamly` benchmark.
• [ocaml-multicore/ocaml-multicore#307] Put the phase change event in
the actual phase change code. The PR includes the
`major_gc/phase_change` event in the appropriate context.
• [ocaml-multicore/ocaml-multicore#309] Don't take all the full pools
in one go.
The code change selects one of the `global_full_pools` to try
sweeping it later, instead of adopting all of the full ones.
• [ocaml-multicore/ocaml-multicore#310] Statistics for the current
domain are more recent than other domains
The statistics (`minor_words`, `promoted_words`, `major_words`,
`minor_collections`) for the current domain are more recent, and are
used in the right context.
• [ocaml-multicore/ocaml-multicore#315] Writes in `caml_blit_fields`
should always use `caml_modify_field` to record `young_to_young`
pointers
The PR enforces that `caml_modify_field()` is always used to store
`young_to_young` pointers.
• [ocaml-multicore/ocaml-multicore#316] Fix bug with `Weak.blit`.
The ephemerons are allocated as marked, but, the keys or data can be
unmarked. The blit operations copy weak references from one
ephemeron to another without marking them. The patch marks the keys
that are blitted in order to keep the unreachable keys alive for
another major cycle.
• [ocaml-multicore/ocaml-multicore#317] Return early for 0 length blit
The PR forces a `CAMLreturn()` call if the blit length is zero in
`byterun/weak.c`.
• [ocaml-multicore/ocaml-multicore#320] Move `num_domains_running`
decrement
The `caml_domain_alone()` invocation needs to be used in the shared
heap teardown, and hence the `num_domains_running` decrement is
moved as the last operation for at least the `shared_heap` lockfree
fast paths.
[ocaml-multicore/ocaml-multicore#303]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/303>
[ocaml-multicore/ocaml-multicore#307]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/307>
[ocaml-multicore/ocaml-multicore#309]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/309>
[ocaml-multicore/ocaml-multicore#310]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/310>
[ocaml-multicore/ocaml-multicore#315]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/315>
[ocaml-multicore/ocaml-multicore#316]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/316>
[ocaml-multicore/ocaml-multicore#317]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/317>
[ocaml-multicore/ocaml-multicore#320]
<https://github.com/ocaml-multicore/ocaml-multicore/pull/320>
Benchmarking
╌╌╌╌╌╌╌╌╌╌╌╌
The [Sandmark] performance benchmarking test suite has had newer
benchmarks added, and work is underway to enhance its functionality.
• [ocaml-bench/sandmark#88] Add PingPong Multicore benchmark
The PingPong benchmark that uses producer and consumer queues has
now been included into Sandmark.
• [ocaml-bench/sandmark#98] Add the read/write Irmin benchmark
A basic read/write file performance benchmark for Irmin has been
added to Sandmark. You can vary the following input parameters:
number of branches, number of keys, percentage of reads and writes,
number of iterations, and the number of write operations.
• [ocaml-bench/sandmark#100] Add Gram Matrix benchmark
A request [ocaml-bench/sandmark#99] to include the Gram Matrix
initialization numerical benchmark was created. This is useful for
machine learning applications and is now available in the Sandmark
performance benchmark suite. The speedup
(sequential_time/multi_threaded_time) versus number of cores for
Multicore (Concurrent Minor Collector), Parmap and Parany is quite
significant and illustrated in the graph:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/2/20dc869a8dda1c815714a97e6a84f6f81c914cf4.png>
• [ocaml-bench/sandmark#103] Add depend target in Makefile
Sandmark now includes a `depend` target defined in the Makefile to
check that both `libgmp-dev` and `libdw-dev` packages are installed
and available on Ubuntu.
• [ocaml-bench/sandmark#90] More parallel benchmarks
An issue has been created to add more parallel benchmarks. We will
use this to keep track of the requests. Please feel free to add your
wish list of benchmarks!
[Sandmark] <https://github.com/ocaml-bench/sandmark>
[ocaml-bench/sandmark#88]
<https://github.com/ocaml-bench/sandmark/pull/88>
[ocaml-bench/sandmark#98]
<https://github.com/ocaml-bench/sandmark/pull/98>
[ocaml-bench/sandmark#100]
<https://github.com/ocaml-bench/sandmark/issues/100>
[ocaml-bench/sandmark#99]
<https://github.com/ocaml-bench/sandmark/issues/99>
[ocaml-bench/sandmark#103]
<https://github.com/ocaml-bench/sandmark/pull/103>
[ocaml-bench/sandmark#90]
<https://github.com/ocaml-bench/sandmark/issues/90>
OCaml
╌╌╌╌╌
◊ Ongoing
• [ocaml/ocaml#9082] Eventlog tracing system
The configure script has now been be updated so that it can build on
Windows. Apart from this major change, a number of minor commits
have been made for the build and sanity checks. This PR is currently
under review.
• [ocaml/ocaml#9353] Reimplement output_value using a hash table to
detect sharing.
The [ocaml/ocaml#9293] "Use addrmap hash table for marshaling" PR
has been re-implemented using a hash table and bit vector, thanks to
@xavierleroy. This is a pre-requisite for Multicore OCaml that uses
a concurrent garbage collector.
As always, we thank the OCaml developers and users in the community
for their code reviews, support, and contribution to the project. From
OCaml Labs, stay safe and healthy out there!
[ocaml/ocaml#9082] <https://github.com/ocaml/ocaml/pull/9082>
[ocaml/ocaml#9353] <https://github.com/ocaml/ocaml/pull/9353>
[ocaml/ocaml#9293] <https://github.com/ocaml/ocaml/pull/9293>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 43742 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-03-24 9:31 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-03-24 9:31 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 13108 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 17 to 24,
2020.
Table of Contents
─────────────────
Luv 0.5.1 — a libuv binding — Windows support
resto 0.2 released
Bisect_ppx 2.0.0 — code coverage for OCaml with nice HTML reports
OCaml 4.09.1 released
Cookie 0.1.6
First release of lwt-pipeline
Using Ocaml as scripting language - piping sh commands
Old CWN
Luv 0.5.1 — a libuv binding — Windows support
═════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/luv-0-5-1-a-libuv-binding-windows-support/5334/1>
Anton Bachin announced
──────────────────────
I am pleased to announce release [0.5.1] of [**Luv**]. The main change
is the addition of Windows support, which makes Luv fully
cross-platform.
Accordingly, Luv 0.5.1 is now installable from both the main opam
repo, and from opam-repository-mingw.
<https://github.com/aantron/luv>
Also, as a side effect of the build system refactoring that was needed
to support Windows, Luv's build system no longer requires Python, and
supports cross-compilation.
The other noteworthy change in release 0.5.1 is a routine upgrade of
the vendored libuv to its latest version, [1.35.0].
[0.5.1] <https://github.com/aantron/luv/releases/tag/0.5.1>
[**Luv**] <https://github.com/aantron/luv>
[1.35.0] <https://github.com/libuv/libuv/releases/tag/v1.35.0>
resto 0.2 released
══════════════════
Archive: <https://discuss.ocaml.org/t/ann-resto-0-2-released/5028/2>
Raphaël Proust announced
────────────────────────
Releases of `resto' 0.3 and 0.4
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
On behalf of Nomadic Labs, I'm happy to announce the release of
versions 0.3 and 0.4 of `resto'. Both versions are available through
`opam' and available on <https://gitlab.com/nomadic-labs/resto>.
The main change in 0.3 is to depend on `json-data-encoding', the fork
of the unmaintained `ocplib-json-typed'.
The changes of 0.4 are more invasive and require users changes:
• handle the new ``Gone' response code, and
• pass `gettimeofday' manually.
This last feature removes a dependency from `resto-cohttp' to `Unix',
and thus helps with use within a `js_of_ocaml' environment.
Bisect_ppx 2.0.0 — code coverage for OCaml with nice HTML reports
═════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/bisect-ppx-2-0-0-code-coverage-for-ocaml-with-nice-html-reports/5338/1>
Anton Bachin announced
──────────────────────
I am pleased to announce [release 2.0.0] of [**Bisect_ppx**], the
OCaml coverage tool, which helps you see which parts of your code are
not being tested.
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/1/1911adc6af898b6f4efd7dc69d2c1f90699031ba.gif>
This release is a major upgrade. The highlights are:
• Support for BuckleScript, js_of_ocaml, and esy. In other words,
Bisect_ppx now compiles to both native code and JS, and is published
in both opam and npm.
• The ability to [send reports automatically] from Travis and CircleCI
to Coveralls and Codecov. More integrations can be added over time.
• The awkward `(*BISECT-IGNORE*)' comments for excluding code from
instrumentation have been replaced by AST attributes like
`[@coverage off]'
(<https://github.com/aantron/bisect_ppx#Exclusion>).
• A new, more principled instrumentation algorithm.
• A new reporter command line based on [Cmdliner]. Run
`bisect-ppx-report --help' to get started with it.
• Syntax highlighting.
You are invited to peruse the all-new [README] for details :)
Several features have been deprecated; mostly command-line flags. You
can see the list in the *Deprecations* section of the
[changelog]. However, it may be easier to simply try using Bisect_ppx
as before – it will warn you if you use a deprecated flag. The
deprecated flags will be removed in Bisect_ppx 2.1.0, expected around
July 2020.
Happy testing!
<https://github.com/aantron/bisect_ppx>
[release 2.0.0]
<https://github.com/aantron/bisect_ppx/releases/tag/2.0.0>
[**Bisect_ppx**] <https://github.com/aantron/bisect_ppx>
[send reports automatically]
<https://github.com/aantron/bisect_ppx#Coveralls>
[Cmdliner] <https://erratique.ch/software/cmdliner/doc/Cmdliner>
[README] <https://github.com/aantron/bisect_ppx#readme>
[changelog] <https://github.com/aantron/bisect_ppx/releases/tag/2.0.0>
OCaml 4.09.1 released
═════════════════════
Archive: <https://discuss.ocaml.org/t/ocaml-4-09-1-released/5341/1>
octachron announced
───────────────────
We have the pleasure of celebrating the anniversary of the first
spacewalk, conducted by Alexei Leonov, by announcing the release of
OCaml version 4.09.1. This is mainly a bug-fix release, with a
handful of configuration fixes and a GC fix backported from 4.10.0
. See the list of changes below for more details.
It is (or soon will be) available as a set of OPAM switches, and as a
source download here:
<https://github.com/ocaml/ocaml/archive/4.09.1.tar.gz>
Changes in 4.09.1:
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• [#9073], [#9120]: fix incorrect GC ratio multiplier when allocating
custom blocks with caml_alloc_custom_mem in runtime/custom.c (Markus
Mottl, review by Gabriel Scherer and Damien Doligez)
• [#8855], [#8858]: Links for tools not created when installing with
–disable-installing-byecode-programs (e.g. ocamldep.opt installed,
but ocamldep link not created) (David Allsopp, report by Thomas
Leonard)
• [#8947], [#9134], [#9302]: fix/improve support for the BFD library
(Sébastien Hinderer, review by Damien Doligez and David Allsopp)
• [#8953], [#8954]: Fix error submessages in the toplevel: do not
display dummy locations (Armaël Guéneau, review by Gabriel Scherer)
• [#8965], [#8979]: Alpine build failure caused by
check-parser-uptodate-or-warn.sh (Gabriel Scherer and David Allsopp,
report by Anton Kochkov)
• [#8985], [#8986]: fix generation of the primitives when the locale
collation is incompatible with C. (David Allsopp, review by Nicolás
Ojeda Bär, report by Sebastian Rasmussen)
• [#9050], [#9076]: install missing compilerlibs/ocamlmiddleend
archives (Gabriel Scherer, review by Florian Angeletti, report by
Olaf Hering)
• [#9144], [#9180]: multiple definitions of global variables in the C
runtime, causing problems with GCC 10.0 and possibly with other C
compilers (Xavier Leroy, report by Jürgen Reuter, review by Mark
Shinwell)
• [#9180]: pass -fno-common option to C compiler when available, so as
to detect problematic multiple definitions of global variables in
the C runtime (Xavier Leroy, review by Mark Shinwell)
• [#9128]: Fix a bug in bytecode mode which could lead to a
segmentation fault. The bug was caused by the fact that the atom
table shared a page with some bytecode. The fix makes sure both the
atom table and the minor heap have their own pages. (Jacques-Henri
Jourdan, review by Stephen Dolan, Xavier Leroy and Gabriel Scherer)
[#9073] <https://github.com/ocaml/ocaml/issues/9073>
[#9120] <https://github.com/ocaml/ocaml/issues/9120>
[#8855] <https://github.com/ocaml/ocaml/issues/8855>
[#8858] <https://github.com/ocaml/ocaml/issues/8858>
[#8947] <https://github.com/ocaml/ocaml/issues/8947>
[#9134] <https://github.com/ocaml/ocaml/issues/9134>
[#9302] <https://github.com/ocaml/ocaml/issues/9302>
[#8953] <https://github.com/ocaml/ocaml/issues/8953>
[#8954] <https://github.com/ocaml/ocaml/issues/8954>
[#8965] <https://github.com/ocaml/ocaml/issues/8965>
[#8979] <https://github.com/ocaml/ocaml/issues/8979>
[#8985] <https://github.com/ocaml/ocaml/issues/8985>
[#8986] <https://github.com/ocaml/ocaml/issues/8986>
[#9050] <https://github.com/ocaml/ocaml/issues/9050>
[#9076] <https://github.com/ocaml/ocaml/issues/9076>
[#9144] <https://github.com/ocaml/ocaml/issues/9144>
[#9180] <https://github.com/ocaml/ocaml/issues/9180>
[#9128] <https://github.com/ocaml/ocaml/issues/9128>
Cookie 0.1.6
════════════
Archive: <https://discuss.ocaml.org/t/ann-cookie-0-1-6/5346/1>
Ulrik Strid announced
─────────────────────
I recently released a cookie library. It can parse and create cookie
headers (`list((string, string)' which both Cohttp and Httpaf uses),
both `Set-Cookie' and `Cookie' so it works on both client and
server. It should be compliant with
<https://tools.ietf.org/html/rfc6265> and I have a pretty good test
suite for the parsing of cookies at least.
I couldn’t find a standalone library before this so I decided to
create one since I need it for my web framework, `Morph'.
The next step is to create and publish integrations with
[`ocaml-session'] which I have started.
• Repo: <https://github.com/ulrikstrid/ocaml-cookie>
• Docs: <https://ulrikstrid.github.io/ocaml-cookie>
[`ocaml-session'] <https://github.com/inhabitedtype/ocaml-session>
First release of lwt-pipeline
═════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-lwt-pipeline/4220/2>
Raphaël Proust announced
────────────────────────
A second release of `lwt-pipeline' (v0.2) is available through
`opam'. This new release makes no change to the code and only affects
the following:
• looser constraints on versions of `dune' dependency,
• tests,
• tests are executed in CI,
• minor documentation improvements.
Using Ocaml as scripting language - piping sh commands
══════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/using-ocaml-as-scripting-language-piping-sh-commands/5366/1>
Nicolas Tollenaere announced
────────────────────────────
I am trying to use ocaml to pipe the result of a command to another (I
would also be interested in feeding a string or a io stream into a sh
command). For example, I would like to do the equivalent of cat
foo.txt | grep thing, or pipe the result of one of my ocaml function
into grep.
Quite surprinsingly, neither the Stdlib or Batteries Sys modules
expose any way to handle the output of Sys.command directly (I would
have thought there would be optional input and output arguments
defaulting to stdin and stdout, or something along that). Batteries IO
module does expose a pipe function but it's not clear for me how it
would interact with the Sys module. Any ideas or other modules/package
I could use ?
Nicolás Ojeda Bär suggested
───────────────────────────
I think you may be interested by
<https://github.com/janestreet/shexp>.
Nicolas Tollenaere then said
────────────────────────────
@grayswandyr @nojb Thanks for the suggestion. I just found shcaml
<http://tov.github.io/shcaml/doc/> and I was going to give it a try,
do you know how it compares to shexp ?
David Chemouil replied
──────────────────────
AFAIK shcaml is unmaintained, but the approach is very nice indeed.
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 26314 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-03-17 11:04 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-03-17 11:04 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 12110 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 10 to 17,
2020.
Table of Contents
─────────────────
Unicode 13.0.0 update for Uucd, Uucp, Uunf and Uuseg
Introducing dune describe
Introducing Model_quickcheck. Quickcheck for stateful, imperative code
Odig 0.0.5
Suggestions for ocaml documentation
Introducing Gopcaml mode - structural OCaml editing
Try OCaml 2.0 (beta)
jose 0.2.0
Old CWN
Unicode 13.0.0 update for Uucd, Uucp, Uunf and Uuseg
════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/unicode-13-0-0-update-for-uucd-uucp-uunf-and-uuseg/5298/1>
Daniel Bünzli announced
───────────────────────
Unicode 13.0.0 was released on the 10th of march.
It adds 5390 characters to the standard including graphic symbols for
legacy computing. If you were looking for characters representing
seven-segment decimal digits, now you [have them]. For the curious,
the [encoding proposal] has the motivation and source of these new
symbols. For more information about all the other additions, see [this
page].
Accordingly the libraries mentioned at the end of this message had to
be updated, consult the individual release notes for details. Both
Uucd and Uucp are incompatible releases sinces new script and block
enumerants had to be added.
Uucp has a new Emoji module with the new emoji properties introduced
in 13.0.0 which are now used by Uuseg to improve emoji
segmentation. The overall compiled size of Uucp shrinked a bit; here
uucp.cmxs went from 7.8Mo to 4.6Mo. Further reduction can likely be
achieved with more work. Thanks to David Kaloper Meršinjak for helping
on this.
A periodic reminder, if Unicode still puzzles you, read an absolute
minimal Unicode introduction and OCaml Unicode tips on [this page]
(also available via `odig doc uucp').
Happy retro computing,
Daniel
P.S. The OCaml compiler [detected] an obsolete rule in the 13.0.0
update of the Unicode line breaking algorithm.
—
Uucd 13.0.0 Unicode character database decoder for OCaml.
<http://erratique.ch/software/uucd>
Uucp 13.0.0 Unicode character properties for OCaml.
<http://erratique.ch/software/uucp>
Uunf 13.0.0 Unicode text normalization for OCaml.
<http://erratique.ch/software/uunf>
Uuseg 13.0.0 Unicode text segmentation for OCaml.
<http://erratique.ch/software/uuseg>
[have them] <https://www.unicode.org/charts/PDF/U1FB00.pdf>
[encoding proposal]
<https://www.unicode.org/L2/L2019/19025-terminals-prop.pdf>
[this page]
<http://blog.unicode.org/2020/03/announcing-unicode-standard-version-130.html>
[this page] <https://erratique.ch/software/uucp/doc/unicode.html>
[detected]
<https://www.unicode.org/mail-arch/unicode-ml/y2020-m03/0000.html>
Introducing dune describe
═════════════════════════
Archive:
<https://discuss.ocaml.org/t/introducing-dune-describe/5300/1>
Jérémie Dimino announced
────────────────────────
Just a quick post to introduce the new `dune describe' command in Dune
2.4.0. If you'd like to write a tool that needs to understand the
structure of a dune project, figure out where the cmt files are
located, etc…, this is the command to look at.
The command is not production ready yet, but the infrastructure is in
place. If you are interested in releasing tools that rely on it,
please let us know so that we can discuss what information you need
out of dune and also so that we can stabilise it.
<https://dune.build/blog/dune-describe/>
Introducing Model_quickcheck. Quickcheck for stateful, imperative code
══════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/introducing-model-quickcheck-quickcheck-for-stateful-imperative-code/5301/1>
suttonshire announced
─────────────────────
I'm sharing a small project I've been working on that I hope will be
interesting or useful to the community. [Model_quickcheck] is a
model-based testing system that allows you to validate the
"properties" of stateful, imperative OCaml programs. It's built on
Jane Street's Base_quickcheck.
I just started learning OCaml and one of the first projects I've been
working on is a user-space reliable transport protocol. Writing tests
for this system became unwieldy because I was trying to validate
certain properties of the protocol by thinking up very specific
sequences of actions that would invoke behaviors that relied on that
property. I got tired of it and got curious if there was a way to
generate these interesting sequences. My research turned up frameworks
like [QCSTM] and [PropEr] for state machine property-based
testing. This seemed to be exactly what I needed so I started building
something similar.
To use Model_quickcheck you specify a set of actions to apply to your
program, a model that describes the state of you program and a set of
predicates that define the properties of you system. The model is
hopefully a simpler representation of your system e.g. a map instead
of a key-value database, or a queue instead of a reliable network
protocol. Model_quickcheck then generates a random sequences of
actions applies them to your system and verifies the properties.
This has been an exciting and useful project. I've learned a bunch
about the Base library, Quickcheck, first class modules, and inline
tests. I'm just getting started, but I just wanted to share the
project with the community since I've learned a lot by lurking here.
[Model_quickcheck] <https://github.com/suttonshire/model_quickcheck>
[QCSTM] <https://github.com/jmid/qcstm>
[PropEr] <https://propertesting.com/book_state_machine_properties.html>
Odig 0.0.5
══════════
Archive: <https://discuss.ocaml.org/t/ann-odig-0-0-5/5304/1>
Daniel Bünzli announced
───────────────────────
`odig' has a new release. See the [release notes] for details.
Installation: `opam install ocaml-manual odig'
Tutorial: <https://erratique.ch/software/odig/doc/manual.html>
odig is a command line tool to lookup documentation of installed OCaml
packages. It shows package metadata, readmes, change logs, licenses,
cross-referenced `odoc' API documentation and manuals.
[release notes]
<https://github.com/b0-system/odig/blob/v0.0.5/CHANGES.md#v005-2019-03-11-la-forclaz-vs>
Suggestions for ocaml documentation
═══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/suggestions-for-ocaml-documentation/4504/50>
sanette announced
─────────────────
The "OCaml API", which is the documentation for the standard library,
is now complete for all versions 4.00–4.10, with a quick search field,
on the demo site:
<https://sanette.github.io/ocaml-api/>
Introducing Gopcaml mode - structural OCaml editing
═══════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/introducing-gopcaml-mode-structural-ocaml-editing/5310/1>
Kiran Gopinathan announced
──────────────────────────
Hi all, I am pleased to announce the first release of Gopcaml-mode, a
new emacs library that aims to extend the existing OCaml editing
experience with structural editing capabilities.
A picture is worth a thousand words, so I'll cut to the chase, and
start with a few demonstrations:
Examples
╌╌╌╌╌╌╌╌
• AST-based code navigation - `C-M-n, C-M-p, C-M-u, C-M-d, C-M-f,
C-M-b'
<https://gitlab.com/gopiandcode/gopcaml-mode/-/raw/master/images/gopcaml_move_expression_example.gif>
• AST-based code transformation -`C-M-N, C-M-P, C-M-F, C-M-B'
<https://gitlab.com/gopiandcode/gopcaml-mode/-/raw/master/images/gopcaml_move_function_example.gif>
• Mark exp - `C-M-SPC'
<https://gitlab.com/gopiandcode/gopcaml-mode/-/raw/master/images/gopcaml_mark_sexp.gif>
• Extract expression into letdef - `C-c C-e'
<https://gitlab.com/gopiandcode/gopcaml-mode/-/raw/master/images/gopcaml_extraction_expressions.gif>
This is just a small sample of the features - a full listing is
provided at the project readme, which can be found at the [project
page].
[project page] <https://gitlab.com/gopiandcode/gopcaml-mode>
Notes
╌╌╌╌╌
This plugin is quite faithful to the OCaml specification and doesn't
reimplement a separate OCaml parser as some other plugins do - instead
I use the Ecaml package (which allows interfacing with Emacs from
OCaml code) to allow delegating to the OCaml parser (from
Ocaml-compiler-libs) directly.
It's in the process of being published to opam, and should be
available to download soon.
Try OCaml 2.0 (beta)
════════════════════
Archive: <https://discuss.ocaml.org/t/ann-try-ocaml-2-0-beta/5325/1>
Louis Gesbert announced
───────────────────────
OCamlPro is happy to announce the release of a new version of the
venerable [Try OCaml tool].
This tool allows you to quickly test OCaml snippets from anywhere,
directly from your browser. It's still in beta, so any issues or
comments are welcome below.
The new version is a complete refactor and redesign, based on the
backend of Learn-OCaml.
Original announcement:
<http://www.ocamlpro.com/2020/03/16/new-version-of-try-ocaml-in-beta/>
[Try OCaml tool] <https://try.ocamlpro.com>
jose 0.2.0
══════════
Archive: <https://discuss.ocaml.org/t/ann-jose-0-2-0/5328/1>
Ulrik Strid announced
─────────────────────
I recently released a JavaScript Object Signing and Encryption library
to opam.
The main usecase for JOSE is JWT and JWK and is a comprehensive
library for both unlike some other libraries that currently exist in
the ecosystem. It uses mirage-crypto and supports RSA and OCT keys
currently and will support EC when mirage-crypto does.
I have not really implemented the encryption part yet but if anyone
needs JWE I'll gladly do the work or accept PRs.
The project was initially developed in Reason but I changed over to
OCaml at some point because of limitations in Reason at the time but
the repo still has the old name.
The docs can be found here:
<https://ulrikstrid.github.io/reason-jose/>
The repo can be found here:
<https://github.com/ulrikstrid/reason-jose/>
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] <mailto:alan.schmitt@polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
[-- Attachment #2: Type: text/html, Size: 25657 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* [Caml-list] Attn: Development Editor, Latest OCaml Weekly News
@ 2020-03-10 14:28 Alan Schmitt
0 siblings, 0 replies; 61+ messages in thread
From: Alan Schmitt @ 2020-03-10 14:28 UTC (permalink / raw)
To: lwn, cwn, caml-list, comp
[-- Attachment #1: Type: text/plain, Size: 23566 bytes --]
Hello
Here is the latest OCaml Weekly News, for the week of March 03 to 10,
2020.
Table of Contents
─────────────────
Non opam workflows
First release of metapp
OCaml 4.10 released
Transept 0.1.0: Generalised Parser Combinators
Multicore OCaml: Feb 2020 update
owl 0.8.0 and 0.9.0 released
Parser combinators vs. parser preprocessors?
Dune 2.4.0
Tyxml 4.4.0
first release of oplsr: an OCaml wrapper to the pls R package - Partial Least Squares (PLS) regression
Old CWN
Non opam workflows
══════════════════
Archive: <https://discuss.ocaml.org/t/non-opam-workflows/5232/1>
Manas asked
───────────
Very recently, I learnt that there is a significant chunk of users in
the OCaml community that does not use opam to install packages. As a
small initiative to contribute to tooling, I want to ensure what I
build is compatible with these workflows - workflows I'm not familiar
with myself.
I'd love to learn more - what does it look like? How do you setup your
compiler, dune and merlin (and/or soon ocamllsp)? How do you configure
your editor to find them and what would make it easier to do so?
I'm told of Duniverse as one tool that being used in these non-opam
workflows. Are there any more popular ones out there?
Théo Zimmermann replied
───────────────────────
I am one of these people. I mostly rely on Nix, whose package
repository nixpkgs provides package sets for all (relatively recent)
versions of OCaml. These package sets are not generally as complete as
what you can find on opam, so it sometimes happens that I open a PR on
the nixpkgs repository to add a new package (and in the meantime I use
my local updated copy of the nixpkgs repo).
You can see the list of available OCaml packages at:
<https://nixos.org/nixos/packages.html?channel=nixpkgs-unstable&query=ocamlPackages>
(This is for the default OCaml version, currently 4.07 in
nixpkgs-unstable. Other package sets are called
`ocaml-ng.ocamlPackages_4_0X' but are not shown in this web search.)
Most OCaml packages are available at a single version in nixpkgs (even
though you can choose your version of OCaml). To gain more flexibility
on the exact version I use in one of my project, I am planning to test
Duniverse. At that point, I would rely on Duniverse for library
dependencies, but I would still rely on Nix to install OCaml, findlib,
Dune, Duniverse (I'll have to take care of packaging it), utop,
merlin, or ocamlformat.
Nix is pretty straightforward to use. You generally provide a
`default.nix' at the root of your repository, and it will list the
dependencies that you use. When you want to go develop your project,
you just enter a special shell (with the `nix-shell' command) and you
are in an environment where the tools you need are in `PATH' and the
libraries you need are in `OCAMLPATH'.
There's just one tool that I needed special configuration for:
`ocamlformat' (especially because some projects use it and some do
not). When I use it, my `default.nix' contains:
┌────
│ shellHook = ''
│ export OCAMLFORMAT_LOCATION=${ocamlformat}
│ '';
└────
which will export an environment variable when I enter the shell.
And my `.emacs' contains:
┌────
│ (setq ocamlformat-location (getenv "OCAMLFORMAT_LOCATION"))
│ (when (> (length ocamlformat-location) 0)
│ (add-to-list 'load-path (concat ocamlformat-location "/share/emacs/site-lisp"))
│ (require 'ocamlformat)
│ (add-hook 'tuareg-mode-hook
│ (lambda () (add-hook 'before-save-hook 'ocamlformat-before-save))))
└────
I want to ensure what I build is compatible with these
workflows
If you mean as a library author, then all you have to ensure is that
you use Dune as the build system (makes the Duniverse workflow better,
and makes it easier to package your library in nixpkgs,
cf. `buildDunePackage' documented at
<https://nixos.org/nixpkgs/manual/#sec-language-ocaml>).
Rwmjones also replied
─────────────────────
You might want to check out the Fedora OCaml packages.
Unfortunately I don't have a convenient way to link to the whole list,
but if you look at all the OCaml packages here:
<https://koji.fedoraproject.org/koji/search?match=glob&type=package&terms=ocaml>*
and then if you substitute the `ocaml-<packagename>' in two places in
this URL:
<https://src.fedoraproject.org/rpms/ocaml-re/blob/master/f/ocaml-re.spec>
(example showing `ocaml-re' package), you can see how we build and
package them in the `%prep', `%build' and `%install' sections.
And yes, please make sure your software doesn't depend on opam.
Building everything in your home directory is not suitable for
enterprise software distribution.
First release of metapp
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-first-release-of-metapp/5250/1>
Thierry Martinez announced
──────────────────────────
I am happy to announce the first release of `metapp', yet another
preprocessor for OCaml. Similarly to [`ppx_optcomp'], `metapp' is a
PPX rewriter. But instead of introducing a specific DSL for
preprocessor directives, `metapp' provides a `[%meta ...]' extension,
where the dots `...' are arbitrary OCaml expressions that are
substituted at compile-time by the AST nodes they evaluate into. These
expressions build AST nodes either by (anti-)quoting some code
directly, or by using `compiler-libs' ([`Parsetree'], [`Ast_helper'],
…).
In particular, this preprocessor is easy to use for conditional
compilation, and is an alternative to [`cppo'] and [`ppx_optcomp'].
┌────
│ let option_get o =
│ [%meta if Sys.ocaml_version >= "4.08.0" then
│ [%e Option.get o]
│ else
│ [%e match o with
│ | None -> invalid_arg "option_get"
│ | Some x -> x]]
└────
In this example, the code between `[%e ... ]' is "anti-quoted": it is
the code that is inserted (conditionally) in the rewritten module. Of
course, the anti-quoted code can contain itself some `[%meta ...]'
code. `[%meta ...]' can even itself contain other levels of `[%meta
...]' code for multi-stage programming.
An example of usage of `metapp' is the [`metaquot'] package, which
implements the same quoters as `ppx_tools.metaquot': `[%expr ...]',
`[%type: ...]', etc. These quoters are implemented by
meta-programming: the meta-code introspects `Parsetree.cmi' from
`compiler-libs' to generate the code matching the current OCaml
version.
[`ppx_optcomp'] <https://github.com/janestreet/ppx_optcomp>
[`Parsetree']
<https://caml.inria.fr/pub/docs/manual-ocaml/compilerlibref/Parsetree.html>
[`Ast_helper']
<https://caml.inria.fr/pub/docs/manual-ocaml/compilerlibref/Ast_helper.html>
[`cppo'] <https://github.com/ocaml-community/cppo>
[`metaquot'] <https://github.com/thierry-martinez/metaquot>
Raphaël Proust added
───────────────