Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of August 15 to 22, 2017.

  1. Bisect_ppx 1.3.0 – code coverage for OCaml
  2. release of batteries-2.7.0
  3. release of minicli-1.0.0
  4. From the OCaml discourse
  5. Ocaml Github Pull Requests
  6. Other OCaml News

Bisect_ppx 1.3.0 – code coverage for OCaml


Anton Bachin announced:
We are pleased to announce release 1.3.0 of Bisect_ppx, the OCaml code
coverage tool. Bisect_ppx generates nice reports, showing which parts of
your code are not tested:

See the release changelog:

This release improves compatibility with Jbuilder. Instructions are
available here:

We have also changed the license from GPL 3.0 to the considerably more
permissive MPL 2.0. MPL allows Bisect_ppx to be incorporated into
proprietary projects. Basically, the only thing users have to do is
publish Bisect_ppx files if

1. they have been modified, and
2. they, or a project incorporating them, is being released.

For publishing, it is sufficient to contribute back to the project, host
a public fork (e.g. on GitHub), or simply include in your larger
project, if that project is open-source.

MPL 2.0 allows private use of modified Bisect_ppx. In practice, you
generally wouldn't release code instrumented with Bisect_ppx anyway, so
this means you can use Bisect_ppx as if it was under a typical
fully-permissive license without worrying about any copyleft

If you are a user of the Bisect_ppx Ocamlbuild plugin, you should depend
on the new bisect_ppx-ocamlbuild OPAM package. It contains an ocamlfind
package of the same name, which is a replacement for the current
bisect_ppx.ocamlbuild. bisect_ppx.ocamlbuild will be removed in a future

The Ocamlbuild plugin remains dedicated to the public domain.

Happy testing!

- The maintainers of Bisect

release of batteries-2.7.0


Francois BERENGER announced:
We are pleased to announce the 2.7.0 release of
OCaml batteries-included.

Batteries Included is a community-maintained standard library
extension, with a focus on performance, stability and compatibility.

Bug reports, pull requests and user feedback are warmly welcome,
see the project page at

The library's API documentation can be found at:

Batteries 2.7.0 is a minor release, compatible with OCaml 4.05.0.

As usual, Batteries is compatible with older OCaml releases as well (until
OCaml-3.12.1), and provides back-ported
versions of most standard library functions made available recently.

After an 'opam update' your will be able to do an
'opam upgrade batteries' an enjoy this new release.

Many thanks to the contributors to this release:

Francois Berenger
Tej Chajed
Varun Gandhi
Clément Pit-Claudel
Gabriel Scherer
Thibault Suzanne
Anton Yabchinskiy

The detailed changelog follows:
## v2.7.0 (minor release)

This minor release is the first to support OCaml 4.05.0. As with
previous OCaml versions, we backported new 4.05.0 convenience function
from the compiler stdlib, allowing Batteries user to use them with
older OCaml versions, and thus write backward-compatible code. In
particular, the new *_opt functions returning option values instead of
exceptions are all backported.

- BatNum: fix of_float_string to handle negative numbers properly
  (Anton Yabchinskiy)

- added BatArray.min_max
  (Francois Berenger)

- added a Label module to BatVect
  (Varun Gandhi, review by Francois Berenger, Gabriel Scherer, Thibault Suzanne)

- fix documentation of BatVect.insert to match (correct) implementation
  #766, #767
  (Gabriel Scherer, report by Varun Gandhi)

- avoid using exceptions for internal control-flow
  #768, #769
    This purely internal change should improve performances when using
    js_of_ocaml, which generates much slower code for local exceptions
    raising/catching than the native OCaml backend.
    Internal exceptions (trough the BatReturn label) have been removed
    from the modules BatString, BatSubstring and BatVect.
  (Gabriel Scherer, request and review by Clément Pit-Claudel)

- added `BatVect.find_opt : ('a -> bool) -> 'a t -> 'a option`
  and BatVect.Make.find_opt
  (Gabriel Scherer)

- Documents exceptions for List.(min, max)
  (Varun Gandhi)

- BatText: bugfixes in `rindex{,_from}` and `rcontains_from`
  (Gabriel Scherer)

- Support for the new OCaml release 4.05
  the `*_opt` functions and List.compare_lengths, compare_length_with
  are also backported to older OCaml releases, so code using them from
  Batteries should be backwards-compatible
  #777, #779
  (Tej Chajed, Gabriel Scherer)

Best regards,
The batteries maintainers.

release of minicli-1.0.0


Francois BERENGER announced:
I am pleased to announce the first release of minicli.
minicli is a minimalist library for command line parsing.

The code is here:

It should be available in opam soon.

A small example being better than a long discourse, here is an example client program:

open Printf

let main () =
  let argc, args = CLI.init () in
  if argc = 1 then
    (printf "usage:\n\
             %s {-i|--input} <file> {-o|--output} <file> -n <int> -x <float> \
             [-v] [--hi <string>]\n" Sys.argv.(0);
     exit 1);
  let input_fn = CLI.get_string ["-i";"--input"] args in
  let output_fn = CLI.get_string ["-o"] args in
  let n = CLI.get_int ["-n"] args in
  let x = CLI.get_float ["-x"] args in
  let verbose = CLI.get_set_bool ["-v"] args in
  let maybe_say_hi = CLI.get_string_opt ["--hi"] args in
  printf "i: %s o: %s n: %d x: %f v: %s\n"
    input_fn output_fn n x (string_of_bool verbose);
  match maybe_say_hi with
  | None -> ()
  | Some name -> printf "Hi %s!\n" name

let () = main ()

Here is an example session of a user playing with this program:
# ./test
./test {-i|--input} <file> {-o|--output} <file> -n <int> -x <float> [-v] [--hi <string>]

# ./test -i
Fatal error: exception CLI.No_param_for_option("-i")

# ./test -i input.txt
Fatal error: exception CLI.Option_is_mandatory("-o")

# ./test -i input.txt -o output.txt
Fatal error: exception CLI.Option_is_mandatory("-n")

# ./test -i input.txt -o output.txt -n /dev/null
Fatal error: exception CLI.Not_an_int("/dev/null")

# ./test -i input.txt -o output.txt -n 123
Fatal error: exception CLI.Option_is_mandatory("-x")

# ./test -i input.txt -o output.txt -n 123 -x /dev/null
Fatal error: exception CLI.Not_a_float("/dev/null")

# ./test -i input.txt -o output.txt -n 123 -x 0.123
i: input.txt o: output.txt n: 123 x: 0.123000 v: false

# ./test -i input.txt -o output.txt -n 123 -x 0.123 -v
i: input.txt o: output.txt n: 123 x: 0.123000 v: true

# ./test -i input.txt -o output.txt -n 123 -x 0.123 -v -i input.bin
Fatal error: exception CLI.More_than_once("-i, --input")

minicli doesn't generate any kind of documentation automatically.
It is up to the programmer to generate a useful and up to date usage message or
to handle {-h|--help}.

More complete solutions to command line parsing are the Arg
module from the stdlib or the cmdliner library.

Best regards,

From the OCaml discourse

The editor compiled this list:
Here are some links to messages at that may
be of interest to the readers.

- Vincent Jacques talks about "DrawGrammar: syntax diagrams of the OCaml language"

Ocaml Github Pull Requests

Gabriel Scherer and the editor compiled this list:
Here is a sneak peek at some potential future features of the Ocaml
compiler, discussed by their implementers in these Github Pull Requests.

- Describe workflow for contributions
- Keep approximation of type representation on abstract types

Other OCaml News

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

Full Time: FPGA Engineer at Jane Street in New York, NY; London, UK

Batteries 2.7.0 released

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