Batteries (OCaml Batteries Included) is a community-developed overlay
over the "standard" library distributed with the compiler, that aims
to provide general-purpose data-structures and convenient functions.
The project follows a semantic versioning scheme; the new version is
backward-compatible with the previous releases (2.2.0 was in January
2014). The lowest OCaml version certainly supported is 3.12.
The new release is available in OPAM, or as a tarball
https://github.com/ocaml-batteries-team/batteries-included/releases/tag/v2.3.0
or from the sources
https://github.com/ocaml-batteries-team/batteries-included
The online API documentation is at:
http://ocaml-batteries-team.github.io/batteries-included/hdoc2/
The main novelty of this new version is the support for the new OCaml
version 4.02. Whenever possible, we have backported new functions from
the 4.02 compiler library: using Batteries 2.3.0 will let you use them
from any OCaml version. You can thus write code using the new 4.2.0
functions that compiles on old OCaml versions. The only exception is
the support for inspecting the callstack, which is not available on
older OCaml versions -- it depends on an OCaml runtime change.
In particular, all new functions related to the new `bytes` datatype
are usable with Batteries 2.3.0, even from older OCaml
versions. However, the new Batteries release does *not* itself compile
with -safe-string (the new OCaml option to make strings immutable). We
plan to release another minor version soon that is -safe-string
ready. You can use Batteries 2.3.0 in user programs compiled with
-safe-string themselves, but you should expect compilation under
-safe-string to break at the next Batteries release, as some
interfaces change from `string` to `bytes`.
With many thanks to the contributors to this new release, including
François Berenger, Vincent Bernardoff, Simon Cruanes, Jacques-Pascal
Deplaix, Mads Hartmann, Max Mouratov, Gabriel Radanne, Xavier Van de
Woestyne, Ralf Vogler and Christopher Zimmermann.
# Detailed changelog
- improved test coverage
(Simon Cruanes and Xavier Van de Woestyne)
- Enum: bugfix in `clamp`
(Simon Cruanes)
- Stream: add `concat_map`
(Gabriel Radanne)
- List: fix a stack-overflow bug in `transpose`
(Gabriel Scherer)
- List: add `unfold_exc : (unit -> a) -> 'a list * exn`
(François Berenger)
- List: add `fold_righti` and `fold_lefti`
(François Berenger)
- Substring : fix `fold_left`, add `fold_lefti`, `fold_righti`
(Xavier Van de Woestyne)
- String : add `fold_lefti` and `fold_righti`
(Xavier Van de Woestyne)
- Set.Make: add `of_list`
(Jacques-Pascal Deplaix)
- AvlTree: add `check : 'a tree -> bool` to check well-formedness
(Simon Cruanes)
- Hashtbl: make `modify_opt/def` resize the table to preserve amortized costs
(Mads Hartmann, report by user 'jj-issuu')
- Enum: fix combine's count in presence of infinite enums
(Gabriel Scherer, report by user 'mwnx')
- Makefile: add a qtest-byte target
(Gabriel Scherer)
- List: add `modify_opt_at: int -> ('a -> 'a option) -> 'a list -> 'a list`
(Gabriel Scherer)
- List: add `modify_at: int -> ('a -> 'a) -> 'a list -> 'a list`
(Gabriel Scherer)
- List: add `remove_at: int -> 'a list -> 'a list`
(François Berenger)
- Int: add `copysign`
(Simon Cruanes)
- Deque: add `rotate_forward`, `rotate_backward : 'a dq -> 'a dq`
(Max Mouratov)
- Int: fix overflow checking in `Safe_int.mul`
(Max Mouratov, Christopher Zimmermann)
- add a local OPAM description
(Vincent Bernardoff)
- Queue: add `map : ('a -> 'b) -> 'a t -> 'b t`
(Christopher Zimmermann)
- compatibility with 4.02:
+ Printf: remove CamlinternalPr for OCaml versions >= 4.02
(Ralf Vogler)
+ Printf: legacy code assumed (string = fmt)
(Gabriel Scherer)
+ new 4.02 functions:
String.mapi (String.init was already in Batteries)
List.sort_uniq (List.sort_unique existed before)
Array.make_float (less efficient implementation provided for <4.02 versions)
a BatBytes module relying on ocamlfind's compatibility module
bytes-related functions in Buffer,Digest,Marshal,Printexc,Stream,Unix
new Printexc callstack interface (not available for <4.02 versions)
(Gabriel Scherer)