Batteries Included project
OCaml Other
Failed to load latest commit information.
benchsuite Update Jan 14, 2014
build minor change in the way lexer directives are emitted by the prefilter… Feb 2, 2017
examples Fix a broken example Jan 22, 2017
howto add a post-install build test Oct 28, 2016
qtest disable warning 52 in the inline tests May 11, 2016
scripts version management scripts Apr 11, 2014
src repared tests for BatArray.shuffle Feb 17, 2017
test-build add a post-install build test Oct 28, 2016
testsuite testsuite: make container tests faster to run May 11, 2016
.gitignore expose `Format.asprintf` for V>=4.01, fixes #597 Jul 23, 2015
.mailmap add a .mailmap entry Jul 1, 2013
.merlin basic .merlin file for merlin users Nov 11, 2013 Travis support, with build status in README Jan 5, 2014
.travis.yml Travis support, with build status in README Jan 5, 2014
ChangeLog Merge branch 'master' into shuffle Feb 17, 2017
FAQ Update the FAQ Jan 22, 2017
LICENSE Updating pointer to clause 3 in LE text to clause 2 as it should be. Feb 7, 2011 fix BatConcreteQueue linking issue May 12, 2016
Makefile Makefile: run qtest from _build for better file paths Feb 3, 2017
README.folders Update README.folders Jan 14, 2014 require ocamlfind>=1.5.3 for the full Bytes compatibility package Sep 23, 2014
_oasis Update _oasis format to 0.4 Oct 28, 2016
_tags update batSys for 4.03 May 10, 2016
batteries_dev.el emacs mode: updating it to qtest2 Feb 19, 2012 Put version number in toplevel banner Nov 21, 2012
check_raise add a style check for '@since NEXT_RELEASE' Oct 26, 2013 fix BatConcreteQueue linking issue May 12, 2016
ocamlinit Fix a typo in ocamlinit that prevents it from loading correctly. Jun 22, 2012
opam minor ./opam lint fix Oct 28, 2016
plot benchmark: fingertrees or sequences in general Feb 18, 2012 Update based on _oasis Oct 28, 2016

Welcome to OCaml Batteries Included

OCaml Batteries Included, or just Batteries, is a community-maintained foundation library for your OCaml projects. Batteries

  • defines a standard set of libraries which may be expected on every compliant installation of OCaml;

  • organizes these libraries into a hierarchy of modules, with a single source of documentation; and

  • provides a consistent API for otherwise independent libraries.

Build Status

Building Batteries


You will need the following libraries:

  • OCaml >= 3.12.1
  • Findlib >= 1.5.3
  • [qtest][] >= 2.0.1
  • GNU make
  • OUnit to build and run the tests (optional)
  • ocaml-benchmark to build and run the performance tests (optional)
  • bisect to compute the coverage of the test suite (optional)

Configuration and Installation

To install the full version of Batteries, execute

$ make all
$ make test test          [ optional ]
$ sudo make install

$ make doc                [ optional ]
$ sudo make install-doc   [ optional ]

If you want the documentation installed elsewhere, set this before starting the build process because this location is stored in the Batteries_config module generated during compilation.

$ export DOCROOT=/path/to/new/docroot/

To disable native compilation:

$ export BATTERIES_NATIVE=false

To disable building of native shared libraries:


Using Batteries

To get started using Batteries at the toplevel, copy the ocamlinit file to ~/.ocamlinit:

$ cp ocamlinit ~/.ocamlinit

If you already have findlib in your ~/.ocamlinit, you only need the last line in our ocamlinit to load batteries.

More usage help available on the batteries-included wiki.

ExtLib Compatibility

If your project currently uses ExtLib, most likely you can just change -package extlib to -package batteries and add open Extlibcompat to the top of any extlib-using modules. Batteries' modules are all named BatFoo to differentiate them from extlib's modules, so one can use Batteries and ExtLib in the same project.

COMPATIBILITY NOTE: If you're using ExtLib's Unzip module, it does not have a corresponding module in batteries at the moment.

Extending Batteries

See doc/batteries/GUIDELINES and the guidelines wiki page.

If you use emacs, the file batteries_dev.el has extra highlighting to support writing quicktests.