OCaml Weekly News

Previous Week Up Next Week


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

The OCaml Weekly News are taking a summer break. See you on August 21st.

Table of Contents

Cucumber.ml 1.0.0

Christopher Yocum announced

Today I would like to announce the 1.0.0 release of Cucumber.ml, which brings Behaviour Driven Development via Cucumber to OCaml. Before I start though, I would like to thank @Thegaram for his contributions and feedback.

I am declaring this 1.0.0 because I wanted to avoid the "forever beta" issue and most of the main features for using Cucumber are implemented so I decided to "just do it".


While many of OCaml's language features tend to reduce the need for testing in general, I still feel that communicating between stakeholders and programmers is important and Cucumber is well-placed to help in that. Additionally, I felt that this was a good way for me to contribute to the OCaml ecosystem in a positive way.


There are a few complications when working with Cucumber.ml. The first and the most important is that Cucumber.ml delegates its Gherkin parsing to the gherkin-c implementation using OCaml's C interface. I did not use CStubs for this because I am not familiar with it and I needed to deal with wchar_t that is used in the gherkin-c and I did not know how to deal with that type via CStubs. This means that, before you can use Cucumber.ml, you will need to compile and install the gherkin-c as a shared library on your system. On Linux, this means you will need to install libgherkin.so in /usr/lib and copy the gherkin-c header files into /usr/include/gherkin.

Cucumber.ml uses the Dune build system. Unfortunately, I have not yet added Cucumber.ml to the Opam package manager. If anyone would like to help me do that, I would be very grateful.

Once you have checked out the code and have the above prerequisites installed, all you need to do is:

dune build && dune install

which will install the cucumber package into your local Opam repository. From there you can write your step definitions in OCaml and run your feature files against them. For more information on how to use Cucumber.ml, please see the Cucumber.ml README file in the repository.

One of the more unusual aspects of Cucumber.ml is that it assumes that once you start executing your step definitions that it will control the command line arguments (and uses Cmdliner for that purpose). This can be surprising so please be aware of it. Basically, the executable created by the compilation process is the cucumber runner and it is that executable which will run your step definitions.


There are many features that come with Cucumber.ml.

  • Gherkin 5.0 is supported (Feature, Background, Given, When, Then, etc.)
  • Datatable transforms (the user can define transformations for datatables but this is not done automatically and must be applied by the user)
  • Before and After steps
  • State passing is handled by the runner and is passed to Step definitions automatically

The state passing feature is, I believe, a first for a Cucumber implementation.


Cucumber.ml will work today and please let me know if you would like any more features. However, here are a few things that I (or anyone else who wants to contribute) will be working on.

  • Update to Gherkin 6.0 using gherkin-go
  • Lwt threading
  • Bring Cucumber.ml fully within the Opam package manager

My main focus will be the first task on the list so I am looking forward to moving to the gherkin-go universal runner.

I hope you enjoy using it as much as I have had making it. If you have any questions, you can ask on the Cucumber Slack or you can drop an issue on the Github issue tracker.

Owl's Computation Graph

Liang announced

Here is an article on Owl's new functor stack (with computation graph injected). The article briefly goes through the motivation, design, and impact of the recent inclusion of computation graph stack into Owl's base library.

Feedback are welcome so I can revise the article. I hope this is useful for you.

link to the article: http://ocaml.xyz/chapter/cgraph_intro.html

Color: library to work with css color formats

Anurag Soni announced

Color is a small library that has utilities to work with different color formats on web frontends. The goal will be to make this easy to use for Css stylings. For now it allows converting between some color formats. I also plan to look into color mixing and adding built-in color names.

This is a first step in exploring typed css descriptions in OCaml.

Any feedback is welcome :slight_smile:

Other OCaml News


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.