Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of November 10 to 17, 2015.

  1. Do we have a B-tree implementation in ocaml?
  2. ppx_deriving_morphism 0.1
  3. Lambda Soup - HTML scraping and rewriting with CSS selectors
  4. Ocaml Github Pull Requests
  5. Other OCaml News

Do we have a B-tree implementation in ocaml?


Continuing the thread from last week, Simon Cruanes announced:
I also have a weight-balanced tree implementation (quite experimental,
but there are tests), in `CCWBTree`
It should provide all the operations you ask for in O(log(n)), and takes
a total order as a parameter.

ppx_deriving_morphism 0.1


Christoph Höger announced:
ppx_deriving_morphism is a plugin for ppx_deriving that attempts to
automatically generate folder and mapper objects in the style of the
ast_mapper from the compiler libs.

This should help compiler-writers and anyone else dealing with
cumbersome recursive functions where most lines are only syntactic
noise (free variables, substitution). The goal is to have
implementations that are convenient to use and extend via the record
update syntax.

A mapper is an object that provides a map routine for each type in the
annotated group of type-definitions.

A ('a,'b) map_routine is a function mapper -> 'a -> 'b

A 'a folder is an object that provides ('a, t) fold_routine for each
type t in the annotated group of type-definitions.

A ('a,'b) fold_routine is a function folder -> 'b -> 'a -> 'a

For each variant-type in the group, a dispatcher and for each variant
a map/fold_routine is generated, so folding and mapping can be
selective for each variant.

Please feel encouraged to test and contribute. The plugin is largely
incomplete but I have only time and motivation to implement what fits
my needs or is useful for several other people. Any kind of feedback
is also appreciated.

The package has just arrived on opam.

Lambda Soup - HTML scraping and rewriting with CSS selectors


Anton Bachin announced:
I would like to announce the release of Lambda Soup, a library for
manipulating HTML documents with CSS selector support. In brief, it
allows expressions such as

(* Print all links. *)

read_file “index.html" |> parse
$$ "a[href]"
|> iter (fun a -> a |> R.attribute "href" |> print_endline)


(* Add ids to all <h2> tags. *)

read_channel stdin |> parse
$$ "h2"
|> iter (fun h2 -> h2 |> set_attribute "id" (R.leaf_text h2))
|> write_channel stdout

The library is based on a set of lazy node traversals (to parents,
children, siblings, etc.). The CSS syntax maps onto these. Types are
used to distinguish HTML node classes (such as text, element, and
document) and reduce the need for error-checking.

The library can be found here:

and the associated documentation is at

OCaml, as an impure functional language with terse syntax, seems very
well-suited to this kind of work. I currently have Lambda Soup
postprocessing its own ocamldoc documentation, and I found this
postprocessor more pleasant to write and maintain than the equivalent
program using Python's Beautiful Soup would have been.

There is some discussion of implementing a new lax HTML(5) parser. This
may be the next thing I will do. Any comments on this, and on Lambda
Soup, are welcome.

Lambda Soup is in OPAM as package "lambdasoup".

Ocaml Github Pull Requests

Gabriel Scherer 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.

make ocamlnat build again

Make backtraces aware of inlining

toplevel: add optional editline support

Other OCaml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the
recent posts from the ocamlcore planet blog at

Erik de Castro Lopo: Forgive me Curry and Howard for I have Sinned.

Coq: Coq 8.5 beta 3 is out!

Functional Jobs: Software Engineer - Functional Programmer - Erlang at Change Healthcare (Full-time)

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