[cwn] Attn: Development Editor, Latest OCaml Weekly News

Alan Schmitt alan.schmitt at polytechnique.org
Tue Apr 25 02:25:59 PDT 2023


Hello

Here is the latest OCaml Weekly News, for the week of April 18 to 25,
2023.

Table of Contents
─────────────────

Dream development stream + OCaml office hours
New release of Menhir (20230415)
Functional web applications running in the browser
Timmy 1.0.0, a high level time and calendar library
Wed, Apr 19 @ 7pm U.S. Central: Jonah Beckford on “What distributing OCaml on Windows gave me (and you)”
The OCaml Changelog
OUPS meetup may 2023
3-year engineering position in Deducteam, Inria Paris-Saclay, France
RFC for a distributed process/actor model library
cfgen preview release v1.0.0-alpha.0
Other OCaml News
Old CWN


Dream development stream + OCaml office hours
═════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/dream-development-stream-ocaml-office-hours/11977/1>


Anton Bachin announced
──────────────────────

  Chat with me while I develop [Dream], but also ask any questions at
  all about OCaml!

        [*<https://www.twitch.tv/antron_ML>*]

  I’ll be streaming Dream development on Twitch at 14:00 CEST (Paris
  time) on most weekdays, and definitely on every Thursday. Each time,
  I’ll stream for at least one hour.

  Tomorrow, on Wednesday, April 19th, at 14:00 CEST, I will be
  continuing to review the [Dream Eio PR] by @talex5 and @Willenbrink,
  adding more detail to and revising the [Dream 1.0 roadmap], and
  generally just be available to talk about anything related to OCaml.
  We can build toy projects, demos, work out concepts, etc. If you’d
  like to contribute to Dream, we can discuss good first issues, review
  your PRs, and collabarote otherwise!

  Outside the stream, I can be reached in #webdev on the [OCaml Discord]
  or #dream on the [Reason Discord]. My nickname on both is *antron*.

  In the future, I’d be happy to consider something more interactive
  than a Twitch stream – something where people can talk back, probably
  some sort of developer or contributor meeting. But it seems that
  Twitch is the right place to get started.


[Dream] <https://github.com/aantron/dream#readme>

[*<https://www.twitch.tv/antron_ML>*] <https://www.twitch.tv/antron_ML>

[Dream Eio PR] <https://github.com/aantron/dream/pull/254>

[Dream 1.0 roadmap]
<https://github.com/aantron/dream/wiki/1.0-Roadmap-Draft>

[OCaml Discord] <https://discord.gg/neFgQbsH>

[Reason Discord] <https://discord.gg/reasonml>


Anton Bachin later said
───────────────────────

  Thanks to everyone for coming to the stream today! We had a pretty
  good viewership! The next stream is tomorrow, Thursday, April 20th, at
  the same time: 14:00 CEST.

  Today, we got the Eio PR building, and found some problems with it –
  fixing those problems offline and during the next stream will be a
  good way to start reviewing the internal changes in detail! We also
  talked about plans for Dream and discussed some of Dream’s
  dependencies and developer tools.

  I post the next stream time and its topic in the banner image of the
  [stream], so you can easily find out when it’s planned even when the
  stream is offline. Planned streams are also in the [schedule]. For
  weekdays besides Thursday, I’ll decide about streaming a few days in
  advance.

  Suggestions for how to make the stream nicer are welcome :) I try to
  maintain a good look for my windows and use some goofy VSCode
  extensions. If we start doing long, boring builds, we can maybe add
  games for viewers to play or even a cat cam, though I think that is a
  stretch at this point :) So far, I’ve been able to do all the very
  slow stuff offline.

  As the stream becomes more of a regular occurrence, I’ll stop posting
  about it here, but I’ll probably continue to announce it in the
  [Reason] and [OCaml Discords], once I figure out what channels are
  appropriate for that. Probably #dream and #webdev, respectively.


[stream] <https://www.twitch.tv/antron_ML>

[schedule] <https://www.twitch.tv/antron_ML/schedule>

[Reason] <https://discord.gg/reasonml>

[OCaml Discords] <https://discord.gg/neFgQbsH>


New release of Menhir (20230415)
════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/ann-new-release-of-menhir-20230415/11983/1>


François Pottier announced
──────────────────────────

  It is my pleasure to announce a new release of Menhir, with a number
  of minor improvements.

  The change log appears below. The main point of notice is that (when
  using the code back-end) the default optimization level has been
  changed from `-O 2' to `-O 1'. So, if you need to keep identical
  generated code and performance, you should now explicitly pass `-O 2'
  to Menhir.

  ┌────
  │   opam update
  │   opam install menhir.20230415
  └────


2023/04/15
╌╌╌╌╌╌╌╌╌╌

  • When using the code back-end, the default optimization level is now
    `-O 1' instead of `-O 2'. Some users reported that `-O 2' is too
    aggressive and can cause a blow-up in the size of the code.

  • Tweak the code for compatibility with OCaml 5.1. (Contributed by
    Florian Angeletti.)

  • The new function `MenhirLib.LexerUtil.tabulate' makes it easy to run
    the lexer and parser in two separate phases. This can be useful when
    one wishes to benchmark them separately.

  • To use the interpreter and print a concrete syntax tree, it used to
    be necessary to pass both `--interpret' and `--interpret-show-cst'.
    It is now sufficient to pass just `--interpret-show-cst'. (If both
    are passed, then only the last one is obeyed.) This fixes the
    assertion failure that would be observed when `--interpret-show-cst'
    alone was used. (Reported by Reed Mullanix.)


Functional web applications running in the browser
══════════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/ann-functional-web-applications-running-in-the-browser/11984/1>


Helmut announced
────────────────

  I am pleased to announce the first release of the library
  [fmlib_browser].

  If you want to write functional web applications running in the
  browser the library [fmlib_browser] might interest you. It allows web
  applications in the [elm] style using the much more powerful language
  ocaml.

  I have discovered the elm language some years ago and I am convinced
  that this kind to write web applications is one important future way
  to develop web applications. So I wanted to have the same in the ocaml
  language. Therefore I have developed this library (and of course using
  js_of_ocaml as the compiler to javascript) and I am quite happy that
  it works well.

  Some [simple examples] of web applications and the corresponding
  [source code] written by using the library [fmlib_browser].

  Install the library via opam by issuing the command

  ┌────
  │     opam install fmlib_browser
  └────


[fmlib_browser] <https://hbr.github.io/fmlib/odoc/fmlib_browser/>

[elm] <https://elm-lang.org/>

[simple examples] <https://hbr.github.io/fmlib/webapp/index.html>

[source code]
<https://github.com/hbr/fmlib/blob/master/src/examples/browser/webapp.ml>


Benjamin Thomas asked and Helmut replied
────────────────────────────────────────

        Hello @hbr, thanks for sharing your project :)

        Did you know about ocaml-vdom before creating this lib?

        <https://github.com/LexiFi/ocaml-vdom>

        If yes, why did you create it? How does it differ?

  @benjamin-thomas: I know the project `ocaml-vdom' and the basic idea
  with respect to virtual dome is very similar. However I wanted to have
  something more generic.

  If you look into the interface of `ocaml-vdom' you see that e.g. the
  event handlers are limited to the definitions in the library. With
  `Fmlib_browser' you can customize your event handlers completely. My
  event handlers use elm’s generic concept of decoders to suck any
  information you want from the events.

  The properties in my library are generic. You can create arbitrary
  javascript value including objects and arrays. In `ocaml-vdom' you are
  limited to primitive values like `int', `float', `string' and `bool'.

  Furthermore I wanted to have a pretty generic interface between the
  javascript world and the ocaml world.

  The concept of `Fmlib_browser' is extendible. In the future I want to
  add features e.g. to start web workers, integrate custom elements to
  have access e.g. to `code mirror'.


Timmy 1.0.0, a high level time and calendar library
═══════════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/ann-timmy-1-0-0-a-high-level-time-and-calendar-library/11986/1>


mefyl announced
───────────────

  I’m pleased to announce the availability on OPAM of the first stable
  version of [Timmy], the library that powers all the time and calendar
  operations we perform at Routine.

  It provides amongst other things:

  • Higher level types for time and calendar values.
  • Uncompromising timezone safety.
  • Timezone with DST support.
  • ISO weeks support.
  • Quality of life operators and common computations on most objects.
  • JavaScript back and forth conversions.

  The philosophy and rationale for the library is [explained at length
  in its root module documentation ]. Comments and contributions very
  welcome.


[Timmy] <https://github.com/mefyl/timmy>

[explained at length in its root module documentation ]
<https://mefyl.github.io/timmy/timmy/index.html>


Wed, Apr 19 @ 7pm U.S. Central: Jonah Beckford on “What distributing OCaml on Windows gave me (and you)”
════════════════════════════════════════════════════════════════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/wed-apr-19-7pm-u-s-central-jonah-beckford-on-what-distributing-ocaml-on-windows-gave-me-and-you/11926/6>


Continuing this thread, jbeckford said
──────────────────────────────────────

  Thanks. Reminds me to share the slides:
  <https://diskuv.gitlab.io/books/DkPresentations/Presentations/2023-04-19-hfpug/>

  I think the recording will be available in several days.


Claude Jager-Rubinson later added
─────────────────────────────────

  The video is now available on the HFPUG website at
  <https://hfpug.org/2023/04/21/jonah-beckford-what-distributing-ocaml-on-windows-gave-me-and-you/>


The OCaml Changelog
═══════════════════

  Archive: <https://discuss.ocaml.org/t/the-ocaml-changelog/11998/1>


Thibaut Mattio announced
────────────────────────

  The OCaml.org team is happy to announce the [OCaml Changelog]: a feed
  of the latest releases and feature highlights of the OCaml Compiler,
  OCaml Platform tools, and other core projects.

  Beyond being the easiest way to stay up to date with the activity of
  official projects, the Changelog serves as a way to discover important
  new features that might otherwise go unnoticed. For instance, did you
  know that Dune 3.7 introduced native polling mode for Windows,
  effectively making watch mode available on Windows (contributed by
  @nojb and [@yams-yams])? Or that we recently released Mdx 2.3.0 with
  support for running code blocks in mld files (contributed by
  @jonludlam)? Or that we added new options in OCamlFormat for more
  consistent vertical formatting of if-else and match statements
  (contributed by @gpetiot)?

  To that end, we’re highlighting important features from the releases
  with visual demos and explanations of how to use them.

  I’ll note that the Changelog is still experimental at this point.
  We’ve talked with some maintainers of the projects featured on the
  Changelog, but we’ll need to agree with everyone on what the release
  process of the tools will look like if we commit to maintaining the
  Changelog in the long term. Until we’ve reached a consensus, the
  OCaml.org team will be monitoring the activity of the projects and
  create the changelog entries, eventually reaching out to maintainers
  to write announcements and feature highlights.

  In the meanwhile, let us know what you think and how we can improve
  the Changelog, we’re excited to get your feedback!

  Happy reading!


[OCaml Changelog] <https://ocaml.org/changelog>

[@yams-yams] <https://github.com/yams-yams>


OUPS meetup may 2023
════════════════════

  Archive: <https://discuss.ocaml.org/t/oups-meetup-may-2023/11999/1>


zapashcanon announced
─────────────────────

  The next OUPS meetup will take place on *Thursday, 11th of May* 2023.
  It will start at *7pm* at the *4 place Jussieu* in Paris.

  :warning: :trumpet: It will be in the in the *Herpin amphitheater* in
  the *Esclangon building*. :trumpet: :warning:

  Please, *[register on meetup]* as soon as possible to let us know how
  many pizza we should order.

  For more details, you may check the [OUPS’ website ].

  This month will feature the following talks :

  *Retrofitting OCaml Modules – Clément Blaudeau*

  ML modules offer large-scale notions of composition and modularity.
  Provided as an additional layer on top of the core language, they have
  proven both vital to the working OCaml and SML programmers, and
  inspiring to other use-cases and languages. Unfortunately, their
  meta-theory remains difficult to comprehend, and more recent
  extensions (abstract signatures, module aliases) lack a complete
  formalization. Building on a previous translation from ML modules to
  Fω, we propose a new comprehensive description of a significant subset
  of OCaml modules, including both applicative and generative functors
  and transparent ascription – a useful new feature. By exploring the
  translations both to and from Fω, we provide a complete description of
  the signature avoidance issue, as well as insights on the limitations
  and benefits of the path-based approach of OCaml type-sharing.

  *Formal reasoning rules for the OCaml FFI –* *Armaël Guéneau*
   (@Armael)

  OCaml provides an FFI mechanism (Foreign Function Interface) allowing
  OCaml programs to call external functions implemented in C, typically
  by writing “glue code” helping bridge the two languages. This “glue
  code” needs to be carefully written and obey a number of rules when
  interacting with the OCaml runtime (cf chapter 22 of the manual).
  Failure to follow one of these rules typically result in silent
  corruption of the program memory, resulting in fatal and hard to debug
  crashes. This presentation will present ongoing research on
  *formalizing* the rules one need to follow to correctly use the OCaml
  FFI. We will see how a small number of *permissions* can capture the
  requirements one must obey in order to write bug-free glue code.


[register on meetup]
<https://www.meetup.com/fr-FR/ocaml-paris/events/292972153>

[OUPS’ website ] <https://oups.frama.io>


3-year engineering position in Deducteam, Inria Paris-Saclay, France
════════════════════════════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/3-year-engineering-position-in-deducteam-inria-paris-saclay-france/12001/1>


Frédéric Blanqui announced
──────────────────────────

  Deducteam is offering a 3-year engineering position to help develop,
  test and maintain tools for proof system interoperability (continuous
  integration, proof libraries management, searching tools, VSCode
  interface, etc.). Net taxable monthly salary between 2148 and 4412
  euros depending on experience, including social security and 9 weeks
  holidays/year.

  Interested people should send me their CV before *30 July 2023*.
  Applications will be examined over time.

  Best regards, Frédéric Blanqui, chair of EuroProofNet.
  <https://blanqui.gitlabpages.inria.fr/>


RFC for a distributed process/actor model library
═════════════════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/rfc-for-a-distributed-process-actor-model-library/12004/1>


Darren announced
────────────────

  I recently wrote down what’s been brewing in my mind for a bit: a
  Erlang style process/actor model library in the new OCaml 5 landscape.
  It is beginning to resemble something I’d use, but I’m curious about
  what others think.

  The repo of the prototype is available at [here]

  The library is built on top of Eio and should place nicely with Eio
  primitives. Snippet of a runnable example is shown below
  (`debug/main.ml' in the repo).

  Overview:
  • `Gateway' plays roughly the role of Erlang’s BEAM VM.
    • Intention is user can establish TLS tunnels to other gateways to
      allow distribution.
  • `Mailbox.Local' API allows skipping the serialization cost when
    sending things internally
    • `Mailbox.Global.t' (when implemented) conversely demands
      serialization procedures during construction.
  • Process *a* uses selective receive interface (`Selective.recv' and
    `Selective.Recv.*') to handle timeout and guards/message filtering.
    • A save queue is used underneath per mailbox for messages rejected
      (for now), following Erlang’s design.
    • Doesn’t seem possible to have a global save queue without also
      serialising everything.
  • Process *b* sends a bunch of things *a* does not care about, wait,
    then finally sends something *a* is looking for.
  • Process *controller* is just largely there to demonstrate one can
    redirect processes.


[here] <https://github.com/darrenldl/distrproc>

Code snippet
╌╌╌╌╌╌╌╌╌╌╌╌

  (`debug/main.ml' on repo)

  ┌────
  │ let () =
  │   let pid_mailbox : Proc.Pid.t Mailbox.Local.t =
  │     Mailbox.Local.make ()
  │   in
  │   let Mailbox.Local.{ send = send_pid; recv = recv_pid } = Mailbox.Local.interface
  │ pid_mailbox in
  │   let x_mailbox  : x Mailbox.Local.t =
  │     Mailbox.Local.make ()
  │   in
  │   let Mailbox.Local.{ send = send_x; recv = recv_x } = Mailbox.Local.interface
  │ x_mailbox in
  │   let a =
  │     Gateway.spawn (fun h ->
  │         Fmt.epr "a: my pid is %a at ." Proc.Pid.pp (Proc.Handle.pid h);
  │ 
  │         let _, send_to = recv_pid h in
  │         Fmt.epr "a: received instruction to send to %a at ." Proc.Pid.pp send_to;
  │         send_x h (send_to, A);
  │         send_x h (send_to, A);
  │         send_x h (send_to, A);
  │ 
  │         let rec aux () =
  │           let success =
  │             Selective.recv h
  │               ~timeout:(1.0, fun () ->
  │                   Fmt.epr "a: I haven't received anything useful yet at .";
  │                   false
  │                 )
  │               Selective.Recv.[
  │                 case_local x_mailbox
  │                   [
  │                     entry ~guard:(fun (from, x) -> x = A)
  │                       (fun (from, msg) ->
  │                          Fmt.epr "a: received %a from %a at ." pp_x msg Proc.Pid.pp
  │ from;
  │                          true
  │                       );
  │                     entry ~guard:(fun (from, x) -> x = B)
  │                       (fun (from, msg) ->
  │                          Fmt.epr "a: received %a from %a at ." pp_x msg Proc.Pid.pp
  │ from;
  │                          true
  │                       );
  │                   ]
  │               ]
  │           in
  │           if not success then
  │             aux ()
  │         in
  │         aux ()
  │       )
  │   in
  │   let b =
  │     Gateway.spawn (fun h ->
  │         Fmt.epr "b: my pid is %a at ." Proc.Pid.pp (Proc.Handle.pid h);
  │         let _, send_to = recv_pid h in
  │         Fmt.epr "b: received instruction to send to %a at ." Proc.Pid.pp send_to;
  │ 
  │         let clock = Eio.Stdenv.clock (Proc.Handle.env h) in
  │ 
  │         send_x h (send_to, C);
  │         send_x h (send_to, C);
  │         send_x h (send_to, C);
  │         send_x h (send_to, C);
  │         send_x h (send_to, C);
  │         send_x h (send_to, C);
  │ 
  │         Eio.Time.sleep clock 5.0;
  │ 
  │         send_x h (send_to, A);
  │ 
  │         let from, msg = recv_x h in
  │         Fmt.epr "b: received %a from %a at ." pp_x msg Proc.Pid.pp from;
  │       )
  │   in
  │   let _controller =
  │     Gateway.spawn (fun h ->
  │         Fmt.epr "controller: my pid is %a at ." Proc.Pid.pp (Proc.Handle.pid h);
  │         send_pid h (a, b);
  │         Fmt.epr "controller: sent instructions to a at .";
  │         send_pid h (b, a);
  │         Fmt.epr "controller: sent instructions to b at .";
  │       )
  │   in
  │   Eio_main.run Gateway.main
  └────


Example output
╌╌╌╌╌╌╌╌╌╌╌╌╌╌

  ┌────
  │   a: my pid is (0, 3)
  │   b: my pid is (0, 4)
  │   controller: my pid is (0, 5)
  │   a: received instruction to send to (0, 4)
  │   controller: sent instructions to a
  │   b: received instruction to send to (0, 3)
  │   controller: sent instructions to b
  │   a: I haven't received anything useful yet
  │   a: I haven't received anything useful yet
  │   a: I haven't received anything useful yet
  │   a: I haven't received anything useful yet
  │   b: received A from (0, 3)
  │   a: I haven't received anything useful yet
  │   a: received A from (0, 4)
  └────


cfgen preview release v1.0.0-alpha.0
════════════════════════════════════

  Archive:
  <https://discuss.ocaml.org/t/ann-cfgen-preview-release-v1-0-0-alpha-0/12016/1>


Chris Armstrong announced
─────────────────────────

  I’m happy to announce the first pre-release of [*cfgen*], a library
  for writing AWS CloudFormation definitions in OCaml and generating
  working CloudFormation templates.

  It is usable in its current form, but still under development. This
  release is to gather feedback and gauge community interest in its
  continued development.

  Please see the [tutorial] and [documentation] to get an understanding
  of how it works and its current feature set.

  You can currently install it directly from git using opam with the tag
  `v1.0.0-alpha.0'

  <https://github.com/chris-armstrong/ocaml-cfgen>


[*cfgen*] <https://github.com/chris-armstrong/ocaml-cfgen>

[tutorial]
<https://chris-armstrong.github.io/ocaml-cfgen/cfgen/tutorial>

[documentation]
<https://chris-armstrong.github.io/ocaml-cfgen/cfgen/index.html>


Other OCaml News
════════════════

>From the ocaml.org blog
───────────────────────

  Here are links from many OCaml blogs aggregated at [the ocaml.org
  blog].

  • [Building reproducible Python environments with XARs]


[the ocaml.org blog] <https://ocaml.org/blog/>

[Building reproducible Python environments with XARs]
<https://blog.janestreet.com/building-reproducible-python-environments-with-xars/>


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 at 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/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20230425/38a507f6/attachment-0001.html>


More information about the caml-news-weekly mailing list