OCaml Batteries Included: Alpha 2 has landed

November 10, 2008 § 10 Comments

note: There seems to have been a WordPress bug. For some reason, the extended release notes on OCaml Batteries Included were replaced by something quite unrelated. My apologies for this.

Dear programmers, I am happy to inform you that the second alpha release of OCaml Batteries Included has landed. You may now download it from the Forge. A GODI package is also available and a Debian package should follow soon (you should be able to find the old one here) and you can read the documentation on-line.

So, what’s new in this release?


  • All the quirks, bugs and erroneous links which plagued the documentation of Alpha 1 should now be gone.
  • Documentation has been extended, with more explanations regarding the use of Input/Output, more explanations on common functions of Pervasives, etc.
  • The top-level now has a on-line help feature. You should try it, it’s nice.
  • New examples, including an 8-liner gzip.


  • The top-level now works.
  • We now have a custom version of ocaml, ocamlc, ocamlopt and ocamlcp. To invoke them, use ocamlfind. For instance, for the new top-level, invoke ocamlfind batteries/ocaml. This should make your life simpler if you don’t use OCamlBuild.


  • Improved Input/Output. In particular, inputs and outputs may now be garbage-collected, automatically closed by higher-order functions, closed manually, closed by their dependencies, or closed automatically when program stops. Speed of key I/O operations was also largely improved.
  • We now have a set of standard combinators for function composition. You won’t need anymore to redefine your |>, <|, etc.
  • Numerous improvements to Unicode, including improved type-safety, Unicode characters on par with Latin-1 characters, etc.
  • We are now very close to being completely rid of legacy channel_in and channel_out, in favor of the more abstract, more composable, safer and more feature-rich IO. In particular, the Unix module and the Standard module are now completely rid of these pesky channels.


  • We now have transparent on-the-fly gzip compression/decompression — more formats are coming.
  • A nice little parser combinator library has been added. It works with either Latin-1, Unicode or custom tokens.
  • An OCaml program may now open a web browser to display a URI. In the future, this will be extended to opening arbitrary files with system-specific tools.
  • Appearance of a foreach loop (which is actually nothing more than Enum.iter, but we don’t have to tell that to beginners).


  • Most data structures now support serialization to/deserialization from S-Expressions.
  • Most data structures now support printing to arbitrary outputs.

What now?

Well, now, we’d appreciate if you could download and install this library. We’d appreciate if you could test your programs against it. And we’d appreciate if you could file bug reports and request for features.

What’s next ?

We’re already at work on the next version.

Here’s an overview of what you can expect in the relatively near future:

  • Re-designed, simpler, module hierarchy (by the way, if you have suggestions, please drop us a line).
  • More syntax extensions, including the long-awaited finally.
  • Exception-less error management in addition to exceptions.
  • More on-the-fly (de)compression formats.
  • Further documentation.
  • Bindings for Camlp4.
  • Unicode transcoding I/O.
  • Further examples.
  • In-memory (de)compression.
  • File and directory management.
  • Shell programming.
  • Pattern-matching on lazy lists.
  • List (and other data structures) comprehension.
  • Compatibility with OCaml 3.11.

Tagged: , , , , , , , , , , , , , , , , , , , ,

§ 10 Responses to OCaml Batteries Included: Alpha 2 has landed

  • Excellent! Keep up the good work!

  • ocaml-3.11.0+beta1 says:

    Manual installing is still a nightmare:
    1) even latest camlzip-1.03 does’t work with ocamlfind
    >ocamlfind query camlzip
    ocamlfind: Package `camlzip’ not found
    >ocamlfind query zip
    ocamlfind: Package `zip’ not found
    ls /usr/local/lib/ocaml/zip/
    dllcamlzip.so gzip.cmi gzip.cmx gzip.mli libcamlzip.a zip.a zip.cma zip.cmi zip.cmx zip.cmxa zip.mli

    2) >sexplib-2.8.6 is broken
    ocamlc -c -for-pack Sexplib -I +camlp4 pa_sexp_conv.mli
    File “pa_sexp_conv.mli”, line 38, characters 3-18:
    Error: Unbound type constructor MLast.type_decl

    and so on …

    Why the hell just not include and properly fix all the nonstandard dependencies?

  • yoric says:

    Manual installing is still a nightmare:

    I’m sorry to hear that. Reports from users of Debian and GODI indicate that installation from source works without problem. What platform are you using?

    Note that we’re not compatible with OCaml 3.11 yet, so you’re doing this in vain (well, not completely, we have a git branch which compiles with OCaml 3.11, but you’ll have to fetch it yourself).

    Why the hell just not include and properly fix all the nonstandard dependencies?

    Because that’s how the CDK failed: by centralizing everything into one source tree, with only three people to maintain a dozen of projects.

  • ocaml-3.11.0+beta1 says:

    I see, thanks for explanation. Maybe you could then document
    which versions are working?
    I am trying to install everything from scratch with the ocaml-3.11.0+beta1.
    (gcc-Version 4.3.2 x86_64-linux-gnu)
    I think GODI is for many reasons broken by design so I don’t use it.

    Now I have managed to install (I think) all the dependencies

    But I get
    make all
    ocamlbuild src/main/threads/batteries.cma
    + ocamlfind ocamlc -c -package camomile -package sexplib -I src/core -I src -I src/main -I src/libs -I src/libs/camlzip -I src/libs/common -I src/core/baselib -I src/core/extlib -I src/core/extlib_threads -I src/core/baselib_threads -I src/core/toolchain -o src/core/extlib.cmi src/core/extlib.mli
    File “src/core/extlib.mli”, line 2798, characters 4-424:
    Error: The variant or record definition does not match that of type

    and I have no idea how locate the mentioned line in a nonexistent
    file 😉

  • ocaml-3.11.0+beta1 says:

    Eh, this can not work as the Unix interface changed in 3.11. Here e.g.:

    diff -ur batteries-20081112-orig/src/core/extlib/extUnix.mli batteries-20081112/src/core/extlib/extUnix.mli
    — batteries-20081112-orig/src/core/extlib/extUnix.mli 2008-11-10 10:58:23.000000000 +0100
    +++ batteries-20081112/src/core/extlib/extUnix.mli 2008-11-11 21:30:22.000000000 +0100
    @@ -1047,6 +1047,8 @@
    | SO_DONTROUTE (** Bypass the standard routing algorithms *)
    | SO_OOBINLINE (** Leave out-of-band data in line *)
    | SO_ACCEPTCONN (** Report whether socket listening is enabled *)
    + | TCP_NODELAY (** Control the Nagle algorithm for TCP sockets *)
    + | IPV6_ONLY (** Forbid binding an IPv6 socket to an IPv4 address *)
    (** The socket options that can be consulted with {!Unix.getsockopt}
    and modified with {!Unix.setsockopt}. These options have a boolean
    ([true]/[false]) value. *)

  • ocaml-3.11.0+beta1 says:

    >we have a git branch which compiles with OCaml 3.1
    Err, I overlooked this somehow 🙂

  • ocaml-3.11.0+beta1 says:

    FYI, camlzip patch and META can be found here

    and the git branch origin/thelema/master2 looks like the right one …

  • anocka says:

    Bravo, c’est vraiment du beau travail ! Je n’aurais jamais pensé que le projet avancerait à cette vitesse !

  • yoric says:

    Merci, merci 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

What’s this?

You are currently reading OCaml Batteries Included: Alpha 2 has landed at Il y a du thé renversé au bord de la table.


%d bloggers like this: