[Caml-list] Attn: Development Editor, Latest OCaml Weekly News

Alan Schmitt
2020-12-29T10:00:32Z

[-- 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 --]