At the moment, on most computers, the easiest manner of installing
OCaml Batteries Included on your computer is to take advantage
of GODI
, a package manager specifically dedicated to OCaml. You will
first need to install GODI, if GODI isn't install on your machine yet,
then to select package batteries
in the list of packages
and accept the decisions of GODI. This should take care of installing
OCaml Batteries Included for you.
Note that producing the documentation is long (typically 10-15 minutes).
On Fedora / Debian / Red Hat / Ubuntu stations,
packages libbatteries-ocaml-dev
.
This should take care of installing OCaml Batteries Included for you.
To perform installation of OCaml Batteries Included manually, please make sure that you have already installed all the following tools and libraries:
Once all these libraries are installed, you may download and uncompress the latest version of OCaml Batteries Included, enter the directory produced by decompression and invoke
make byte opt doc installto build and install both the byte-code version, the native version and the documentation of OCaml Batteries Included. If you are not interested in respectively the byte-code version, the native version or the documentation of OCaml Batteries Included, just omit respectively
byte
, opt
or doc
from that command.
Note that producing the documentation is long (typically 10-15 minutes).
ocamlfind batteries/ocaml
,
or, if you have rlwrap
installed,
rlwrap ocamlfind batteries/ocaml
, for more comfortable editting.
date.ml
, invoke ocamlfind batteries/ocaml date.ml
.
You may also invoke ocamlfind batteries/ocaml --help
for more informations on the interpreter.
date.ml
, invoke ocamlfind batteries/ocamlc date.ml
.
You may also invoke ocamlfind batteries/ocamlc --help
for more informations on the bytecode compiler.
date.ml
, invoke ocamlfind batteries/ocamlopt date.ml
.
You may also invoke ocamlfind batteries/ocamlopt --help
for more informations on the optimizing compiler.
date.ml
, invoke ocamlfind batteries/ocamlcp date.ml
.
You may also invoke ocamlfind batteries/ocamlcp --help
for more informations on the profiling compiler.
date.ml
and all the files it requires
to bytecode, invoke date.ml
and all the files it requires
to an optimized native binary, invoke doc/batteries/myocamlbuild.ml
is an extension of OCamlBuild. It defines Control.Concurrency.Threads
.pkg_batteries
, you need to start your
files with open Batteries
.use_batteries
as they can suddenly
turn correct code into something which doesn't compile. Use tag
use_boilerplate
in conjunction with either use_batteries
or
use_batteries_r
._tags
, placed in the same directory
as your files. For instance, to have my_file.ml
compiled with
Batteries Included as a library and my_other_file.ml
compiled
with both the library, the language extensions and boiler-plate code, your
file _tags
should read:
<my_file.ml>: pkg_batteries <my_other_file.ml>: use_batteries,use_boilerplateThe order of lines doesn't matter, nor does the order of tags on one line. For more informations on
myocamlbuild.ml
and _tags
, see
the documentation
of OCamlBuild.
where
dual to let
.Batteries
.batteries
and package threads
.batteries
without using package threads
.
USE_OCAMLFIND = true
OCAMLPACKS[] +=
batteries.pa_openin.syntax
batteries.pa_where.syntax
batteries.pa_batteries.syntax
batteries.pa_comprehension.syntax
batteries.pa_type_conv.syntax
batteries.pa_strings.syntax
batteries
OCAMLDEPFLAGS += -syntax camlp4o
OCAMLFLAGS += -syntax camlp4o
Here's a complete OMakefile for building the "cat" implementation you will
find under the examples/ subdirectory:
USE_OCAMLFIND = true
OCAMLPACKS[] +=
batteries.pa_openin.syntax
batteries.pa_where.syntax
batteries.pa_batteries.syntax
batteries
OCAMLDEPFLAGS += -syntax camlp4o
OCAMLFLAGS += -syntax camlp4o
OCamlProgram(cat, cat)
The above OCAMLPACKS definition uses Batteries and all the non-destructive
syntax extensions available as of 2008-11-16; this corresponds to the
use_batteries
tag in ocamlbuild.
If you only want to use Batteries as a library, without syntax extensions, use
OCAMLPACKS[] += batteries
and drop the OCAMLDEPFLAGS
and OCAMLFLAGS
lines in the above examples, as they are no longer needed.