• en

OCaml Weekly News

The OCaml Weekly News is a summary of the messages sent to the OCaml forums and mailing list compiled by Alan Schmitt.

Here is the latest OCaml Weekly News, for the week of April 17 to 24, 2018.

  1. opam-check-all: Are your packages broken for the upcoming OCaml releases?
  2. ppxlib - Jane Street ppx infrastructure now on github
  3. OCaml for Data Science
  4. First release of open
  5. OCaml Documentation Open Thread
  6. llpp v27
  7. Duff 0.1 - a diff library
  8. Rfsm 1.0
  9. Emacs package for automatic type display
  10. Lwt is now MIT-licensed
  11. Other OCaml News

opam-check-all: Are your packages broken for the upcoming OCaml releases?

Archive: https://discuss.ocaml.org/t/ann-opam-check-all-are-your-packages-broken-for-the-upcoming-ocaml-releases/1875/1

Kate announced:
OCaml 4.07.0 is not far from being released, and, as usual, some opam packages
need some adjustments or a new compatible release.
To be able to track which packages need fixes I'm please to offer the following
webpage which tries to summaries this:

This bleak (sorry for that) webpage also allows to select the compilers you want
to check. For instance:

* The difference between `4.05.0` and `4.06.1`:
* The difference between `4.06.1` and `4.07.0+beta2`:

Available compilers are listed on the main page.

This webpage is for the moment very bleak and needs lots of improvements but is
being actively developed.
For the moment the checks are not updated automatically but it's definitely the
next feature I'm planning to add.

The source code is available here:


The purpose of this tool is very close to `obi` announced
and other similar tools like
[opam-builder](https://github.com/OCamlPro/opam-builder) and
[ows](https://github.com/OCamlPro/ows). My apologies if I'm making yet another
checker here. `opam-check-all` started as a small shell script but I recently
decided to rewrite it fully as a small OCaml program and use it to check the
next OCaml release. I plan to keep it small and easy to use as much as possible.

But anyway, if one day you happen to be bored and you want to fix opam packages,
this webpage will be here to help you (IP address/domain name suspect to

PS: I'll update this thread when I'll get a proper domain name.

ppxlib - Jane Street ppx infrastructure now on github

Archive: https://discuss.ocaml.org/t/ann-ppxlib-jane-street-ppx-infrastructure-now-on-github/1876/1

Xavier Clerc announced:
We, Jane Street ppx developers, are glad to announce the public availability
of the [ppxlib project][1]. This project is the merge of several ppx-related
repositories, including [ppx_core][2], [ppx_driver][3], [ppx_metaquot][4],
and [ppx_type_conv][5]. As such, ppxlib contains all the core elements one
needs to develop ppx rewriters.

While this is not the first project released as open source by Jane Street,
this one is slightly different as the whole development now happens on
github. In particular, we are using a PR-based workflow and will gladly add
external contributors to the project (see [details][6]). We are moving to this
workflow with the hope that it will make the collaboration with other
open source projects easier.

The project is currently released as 0.2.0 in opam. We are planning to
make some changes before the 1.0 release, most notably adding support
for [view patterns][7] and improving the documentation.

Contributions are warmly welcome!


OCaml for Data Science

Archive: https://discuss.ocaml.org/t/ocaml-for-data-science/1878/1

Volodymyr Melnyk asked:
Hello. Do you use OCaml for data science? - If so - could you please provide a
short info about the status of data science in OCaml? I mean:

- What makes OCaml good/bad for data science (long story short of your
experience with OCaml in this area)?

- What the OCaml alternatives for Python's Pandas, NumPy, SciPy, etc.?

- Do you know some frontier companies/products/projects that uses OCaml for data

- Is there any problems that are related to data science and was solved by other
platforms, but not by OCaml as a platform?

- Maybe you may give me a good piece advise related to both OCaml and data science.

Thank you for your response.
UnixJunkie replied:
I use ocaml for machine learning these days.
But I'm just a user in this area, not a researcher in those topics.

Here are my thoughts:

1 What makes OCaml good/bad for data science (long story short of your
experience with OCaml in this area)?

OCaml is good for fast but correct prototyping of scientific software.

2  What the OCaml alternatives for Python’s Pandas, NumPy, SciPy, etc.?

Maybe owl for numpy.
But the ocaml ecosystem is for sure less developed than the python one in this area.

3 Do you know some frontier companies/products/projects that uses OCaml for data

People at NYU in the Hammer lab. If you consider bioinformatics data science (I
guess they handle a lot of data and do science, so to me that's data science).

4 Is there any problems that are related to data science and was solved by other
platforms, but not by OCaml as a platform?

I don't know.

5 Maybe you may give me a good piece advise related to both OCaml and data science.

Let's say you are in OCaml, but you really need to access the functionality f
from Python module m.
You can write a small Python script to call m.f, then call this script from the
ocaml side and read its result from there too.
Recently, I did this for several R packages I wanted to use (I want to stay in
OCaml, R's language is just crazy, like some kind of Perl on steroids).
Marshall Abrams then said:
As @UnixJunkie suggested, I think it's worth looking at
[Owl](https://github.com/owlbarn/owl). It is still in early stages in many ways,
but in other ways it seems fairly mature, and, its capabilities seem to be
growing quickly. (Parts of the interface may change, though.)
n4323 said and Yoriyuki Yamagata replied:
> I have been using OCaml for simulations and a model fitting which could be
> considered data science to some extent. For that I used lacaml (good but
> bare-metal) and for optimization i resorted to gsl-ocaml. Compared to other
> ecosystems these are really basic tools. I was a bit limited in what I could
> achieve in a small amount of time.
> I will second Owl. It's basically trying to do what you are looking for. So far
> it has most of the functionality of numpy, some of scipy (optimization, special
> functions) and it also provides automatic differentiation and through that,
> neural network functionality.
> I’m not aware of any OCaml library that does dataframes

Some previous discussion on this

First release of open

Archive: https://discuss.ocaml.org/t/ann-first-release-of-open/1882/1

Steffen Smolka announced:
I'm pleased to announce the first release of `open`, a single-function library
that allows one to open files in their default applications straight from OCaml:
$ opam install open
$ ocaml
> #require "open";;
> Open.in_default_app "/path/to/my/favorite.pdf";;
- : bool = true
// pdf viewer opens and displays favorite.pdf
> Open.in_default_app "/nonexistent/file.jpg";;
- : bool = false
// nothing happens
> Open.in_default_app ".";;
- : bool = true
// file manager opens in current working directory
I found myself copying this code to many of my projects, so even though it's
just a few lines of OCaml I thought it may be useful to others as well. At a
minimum, it will save me some copying in the future...

The library is [hosted on Github](https://github.com/smolkaj/ocaml-open) and you
can find more examples, details, and the API documentation there. Contributions
are always welcome (e.g., I have not been able to test the library on a native
Windows version of OCaml).

The [release of
v0.2.1](https://github.com/smolkaj/ocaml-open/releases/tag/v0.2.1) is currently
[pending](https://github.com/ocaml/opam-repository/pull/11824) and introduces
support for Cygwin and paths containing whitespace.

OCaml Documentation Open Thread

Archive: https://discuss.ocaml.org/t/ocaml-documentation-open-thread/1841/121

Deep in this thread, Anton Bachin said:
I don't have time to do it immediately, but I will gladly merge any PRs to
[odoc](https://github.com/ocaml/odoc) that make the CSS more Racket-like, or add
a left-hand index, especially one that disappears/gets inlined into each page
when the page gets smaller.

Regarding the index, see discussion
Anton Bachin later adder:
I also want to add that the guide on contributing to CSS is
and [this is the CSS
file](https://github.com/ocaml/odoc/blob/master/src/odoc/etc/odoc.css) to edit.
It needs a general reorganization and refactoring, so please go ahead and do
that if you find the current one difficult to work on.

If more elements need to be rendered by odoc, or the current markup is
inconvenient in any way, please open issues, and we can fix it.

To install the development odoc and try everything out, see the

1. Clone and pin the repo:

    git clone https://github.com/ocaml/odoc.git
    cd odoc
    opam pin add --no-action odoc .

2. Install the development odoc:

    opam install odoc

3. Test it on any Jbuilder project:

    jbuilder build @doc

    the output will be generated at `_build/default/_doc/_html/index.html` under
the project's directory.

For editing CSS, you can probably edit it in the browser, then send a PR for the
changes. The CSS file odoc generates is just a copy of the one in the repo, and
it is at `_build/default/_doc/_html/odoc.css`, if you'd like to apply the
changes there while testing. If you want to apply them, more permanently, to
your local odoc clone, edit [odoc's CSS
file](https://github.com/ocaml/odoc/blob/master/src/odoc/etc/odoc.css), then do
a commit, and

opam reinstall -y odoc
jbuilder build @doc

to test.

llpp v27

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2018-04/msg00065.html

moosotc announced:
New version of llpp (tagged v27) released and can be found at:
* http://repo.or.cz/w/llpp.git
* https://github.com/moosotc/llpp/


llpp is a graphical PDF viewer, which aims to superficially resemble

Changes (relative to v26b)

* unified build-system
* man pages (Hendrik Rosendahl, big thanks to him)
* improved font viewer via llppac
* new videos
* bootstrap script (appears to work on Linux, MacOS and Window Subsystem
  for Linux)
  fetch and build everything that is needed (ocaml, mupdf)
* bugfixes

Summary v26..v27
   315	malc
     3	Nicolás Ojeda Bär
     2	Hendrik Rosendahl
     1	Florian Stecker
     1	German Zhivotnikov

Diffstat v26..v27
 .dir-locals.el                     |    2 +-
 .gitignore                         |    3 +
 .mailmap                           |    4 +
 BUILDING                           |   42 +-
 KEYS                               |    7 +-
 Shakefile.hs                       |  228 --------
 Thanks                             |    5 +-
 build.sh                           |  325 ++++++++---
 config.ml                          |  102 +++-
 diag.h                             |    8 +
 glfont.c                           |   51 +-
 link.c                             | 1062 +++++++++++++++---------------------
 main.ml                            |  363 ++++++------
 main_osx.m                         |  100 ++--
 man/asciidoc.conf                  |   17 +
 man/llpp.man                       |  136 +++++
 man/llppac.man                     |   41 ++
 man/llpphtml.man                   |   32 ++
 misc/.gitignore                    |    2 +
 misc/{Info.plist => Info.plist.sh} |    6 +-
 misc/bootstrap.sh                  |   43 ++
 misc/completions/llpp.in           |    2 +
 misc/cutrel                        |    2 +-
 misc/llppac                        |  251 ++++++---
 misc/llpphtml                      |   28 +
 misc/prince.css                    |   14 +-
 misc/wikipedia/wiki2.css           |   21 +-
 mkhelp.sh                          |   15 -
 todo.org                           |   22 +-
 utils.ml                           |   23 +-
 wsi/x11/wsi.mli => wsi.mli         |    1 -
 wsi/osx/wsi.ml                     |    1 -
 wsi/x11/wsi.ml                     |   24 +-
 33 files changed, 1657 insertions(+), 1326 deletions(-)

Duff 0.1 - a diff library

Archive: https://discuss.ocaml.org/t/ann-duff-0-1-a-diff-library/1887/1

Calascibetta Romain announced:
I'm happy to announce [`duff`](https://github.com/dinosaure/duff) is now
available on OPAM.

This package is an implementation of
[`libXdiff`](http://www.xmailserver.org/xdiff-lib.html) in OCaml tuned for
[`ocaml-git`](https://github.com/mirage/ocaml-git). This library can produce a
_hash-table_ from a source and produce an unreadable diff with a _target_.

Then, we have a tight representation of your _target_ which can be reconstructed
(patch) with your source. This package provides a little binary `duff` which do
this transformation as an example:

$ ./duff.exe diff source target > target.xduff
$ ./duff.exe patch source < target.xduff > target.new
$ diff target target.new
$ echo $?

Of course, as a part of MirageOS project (and specially a part of ocaml-git),
this package does not need an unix environment. Finally, this package is
obviously close to ocaml-git and respects some restrictions explained in the
[README.md](https://github.com/dinosaure/duff/blob/master/README.md). As [others
extracted parts of ocaml-git](https://github.com/dinosaure/encore), this library
needs improvements about API, so feel free to participate.

Good patch!

Rfsm 1.0

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2018-04/msg00076.html

Jocelyn Sérot announced:
This is my pleasure to announce the availability of the first public version
(1.0) of Rfsm, a toolset for describing and simulating StateChart-like state
diagrams. The toolset is composed of

-   an Ocaml library
-   a command-line compiler
-   a Qt-based GUI application

The provided tools take
-   a description of a system as a set of StateChart-like state diagrams
-   a description of stimuli to be used as input for this system

and generate
- a graphical representation of the system (to be viewed with Graphviz
(http://www.graphviz.org) for example)
- execution traces as `.vcd` files (to be viewed with Gtkwave
(http://gtkwave.sourceforge.net) for example)

Additionnaly, dedicated backends can generate system descriptions in
- CTask (a C dialect with primitives for describing tasks and event-based
-   SystemC
-   VHDL
for simulation of implementation.

The Rfsm compiler is, of course, written in OCaml.


The project web page (including links for downloading the tools) is at

The user manual can be downloaded here :

The library API is documented here :


Prebuilt Windows and MacOS versions can be downloaded from the project webpage

Source code is available from the project webpage or via (`git clone

An OPAM package (including the library and the command-line compiler) is in preparation.

Feedbacks, comments, bug reports welcome !

Emacs package for automatic type display

Archive: https://discuss.ocaml.org/t/emacs-package-for-automatic-type-display/1897/1

Louis Roché announced:
I have been trying during my free time to create a small Emacs package to
automatically display the type of the element under the point after a small
delay. You move the cursor on a word, wait 0.5s and it will do the same thing as
`M-x merlin-type-enclosing`. The package is of coursed based on merlin.

This is inspired by what exist in the emacs-lisp mode (which displays
information about the value at point in the message box), tide (which displays
the type under the point) and what exist in other editors.

The result is here https://github.com/Khady/merlin-auto-hl/blob/master/merlin-auto-hl.el

This is not very clean or nice. But it covers basic usage (I think). And I am
now seeking for help.

What is necessary to make it really usable:
- Make it a real mode. I don't know how to do that exactly. I mostly copy/pasted
this part, so it needs a refresh.
- Stop the auto display when an action is going on. For example if the cursor is
moved in a string, then execute `C-h k RET C-c C-t`, the help for the keybinding
is not displayed. The action is interrupted.
- Publish on melpa or something like this.

Nice improvements that I would like to have:
- Highlight of all occurrences. The position of all occurrences can be taken
from `merlin-occurrences` so it shouldn't be too hard to too. But I don't know
yet how to handle highlighting of multiple values and how to remove the
highlight later. I think I need to import more pieces from
- Cleanup the code to follow good emacs lisp practices.

If you know some emacs lisp and can give advice or if you can contribute a
patch, it would be very cool.

The name of the package is not definitive. Ideas are welcomed for this too.

I hope this presentation is clear enough. Not a native english speaker. Please
ask any question is something needs more details.

Some links related to this work:
- https://github.com/ocaml/merlin/issues/796
- https://github.com/ananthakumaran/tide/blob/master/tide.el#L1991-L2096
- https://github.com/ocaml/merlin/issues/500
- https://github.com/fsharp/emacs-fsharp-mode/blob/master/fsharp-doc.el

Lwt is now MIT-licensed

Archive: https://discuss.ocaml.org/t/lwt-is-now-mit-licensed/1901/1

Anton Bachin announced:
By popular request, the license of [**Lwt**](https://github.com/ocsigen/lwt) is
now [MIT](https://github.com/ocsigen/lwt/blob/master/LICENSE) :slight_smile:

Lwt was previously licensed under a combination of LGPL, a linking exception,
and BSD, which could be confusing to deal with in cases where licensing really
matters. We hope the MIT license makes Lwt a bit easier on users.

The MIT license applies to future releases of Lwt, and to `master` starting today.

Thanks to all the contributors who have given permission, and participated in
the discussion on the switch!


Other OCaml News

From the ocamlcore planet blog:
Here are links from many OCaml blogs aggregated at OCaml Planet,

Release of Alt-Ergo 2.2.0

The Bitcoin Piñata - no candy for you

Whacking the Bitcoin Piñata

Coq 8.8.0 is out

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