CINXE.COM
OCaml - The OCaml Manual
<!DOCTYPE html><html lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="generator" content="hevea 2.36"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <title>OCaml - The OCaml Manual</title> <link rel="stylesheet" type="text/css" href="manual.css"> <script src="scroll.js"></script><script src="navigation.js"></script><script defer data-domain="ocaml.org" src="https://plausible.ci.dev/js/script.js"></script><link rel="shortcut icon" type="image/x-icon" href="favicon.ico"></head> <body><div class="index content manual"><div id="sidebar-button"><span>☰</span></div><ul id="part-menu"></ul> <div class="maintitle"><h1><span>The OCaml system</span> release 5.3 </h1><h3>January, 2025</h3></div><div class="maintitle"> <br> This manual is also available in <a href="https://ocaml.org/releases/5.3/ocaml-5.3-refman.pdf">PDF</a>, <a href="https://ocaml.org/releases/5.3/ocaml-5.3-refman.txt">plain text</a>, as a <a href="https://ocaml.org/releases/5.3/ocaml-5.3-refman-html.tar.gz">bundle of HTML files</a>, and as a <a href="https://ocaml.org/releases/5.3/ocaml-5.3-refman.info.tar.gz">bundle of Emacs Info files</a>. </div><header id="sidebar"><nav class="toc brand"><a class="brand" href="https://ocaml.org/"><img src="colour-logo.svg" class="svg" alt="OCaml"></a></nav><nav class="toc"><div class="toc_version"><a id="version-select" href="https://ocaml.org/releases/">Select another version</a></div><ul><li class="top"><a href="#">The OCaml Manual</a></li> <li><a href="manual001.html">Contents</a> </li><li><a href="foreword.html">Foreword</a> </li><li><a href="manual075.html">Index of keywords</a></li><li><a href="api/index.html">OCaml API</a></li><li><a href="api/compilerlibref/index.html">OCaml Compiler API</a></li></ul></nav></header><ul class="ul-content"> <li><a href="manual001.html">Contents</a> </li><li><a href="foreword.html">Foreword</a> </li></ul> <table class="center"><tbody><tr><td><h1 class="part" id="sec6"><span class="number">I.</span> An introduction to OCaml</h1></td></tr> </tbody></table> <p> <a id="p:tutorials"></a> </p> <ul> <li><a href="coreexamples.html"><span class="number">1.</span> The core language</a> </li><li><a href="moduleexamples.html"><span class="number">2.</span> The module system</a> </li><li><a href="objectexamples.html"><span class="number">3.</span> Objects in OCaml</a> </li><li><a href="lablexamples.html"><span class="number">4.</span> Labeled arguments</a> </li><li><a href="polyvariant.html"><span class="number">5.</span> Polymorphic variants</a> </li><li><a href="polymorphism.html"><span class="number">6.</span> Polymorphism and its limitations</a> </li><li><a href="gadts-tutorial.html"><span class="number">7.</span> Generalized algebraic datatypes</a> </li><li><a href="advexamples.html"><span class="number">8.</span> Advanced examples with classes and modules</a> </li><li><a href="parallelism.html"><span class="number">9.</span> Parallel programming</a> </li><li><a href="memorymodel.html"><span class="number">10.</span> Memory model: The hard bits</a> </li></ul> <table class="center"><tbody><tr><td><h1 class="part" id="sec111"><span class="number">II.</span> The OCaml language</h1></td></tr> </tbody></table> <p> <a id="p:refman"></a> </p> <ul> <li><a href="language.html"><span class="number">11.</span> The OCaml language</a> </li><li><a href="extn.html"><span class="number">12.</span> Language extensions</a> </li></ul> <table class="center"><tbody><tr><td><h1 class="part" id="sec340"><span class="number">III.</span> The OCaml tools</h1></td></tr> </tbody></table> <p> <a id="p:commands"></a></p> <ul> <li><a href="comp.html"><span class="number">13.</span> Batch compilation (ocamlc)</a> </li><li><a href="toplevel.html"><span class="number">14.</span> The toplevel system or REPL (ocaml)</a> </li><li><a href="runtime.html"><span class="number">15.</span> The runtime system (ocamlrun)</a> </li><li><a href="native.html"><span class="number">16.</span> Native-code compilation (ocamlopt)</a> </li><li><a href="lexyacc.html"><span class="number">17.</span> Lexer and parser generators (ocamllex, ocamlyacc)</a> </li><li><a href="depend.html"><span class="number">18.</span> Dependency generator (ocamldep)</a> </li><li><a href="ocamldoc.html"><span class="number">19.</span> The documentation generator (ocamldoc)</a> </li><li><a href="debugger.html"><span class="number">20.</span> The debugger (ocamldebug)</a> </li><li><a href="profil.html"><span class="number">21.</span> Profiling (ocamlprof)</a> </li><li><a href="intfc.html"><span class="number">22.</span> Interfacing C with OCaml</a> </li><li><a href="flambda.html"><span class="number">23.</span> Optimisation with Flambda</a> </li><li><a href="afl-fuzz.html"><span class="number">24.</span> Fuzzing with afl-fuzz</a> </li><li><a href="runtime-tracing.html"><span class="number">25.</span> Runtime tracing with runtime events</a> </li><li><a href="tail_mod_cons.html"><span class="number">26.</span> The “Tail Modulo Constructor” program transformation</a> </li><li><a href="tsan.html"><span class="number">27.</span> Runtime detection of data races with ThreadSanitizer</a> </li></ul> <table class="center"><tbody><tr><td><h1 class="part" id="sec646"><span class="number">IV.</span> The OCaml library</h1></td></tr> </tbody></table> <p> <a id="p:library"></a> </p> <ul> <li><a href="core.html"><span class="number">28.</span> The core library</a> </li><li><a href="stdlib.html"><span class="number">29.</span> The standard library</a> </li><li><a href="parsing.html"><span class="number">30.</span> The compiler front-end</a> </li><li><a href="libunix.html"><span class="number">31.</span> The unix library: Unix system calls</a> </li><li><a href="libstr.html"><span class="number">32.</span> The str library: regular expressions and string processing</a> </li><li><a href="runtime_events.html"><span class="number">33.</span> The runtime_events library</a> </li><li><a href="libthreads.html"><span class="number">34.</span> The threads library</a> </li><li><a href="libdynlink.html"><span class="number">35.</span> The dynlink library: dynamic loading and linking of object files</a> </li><li><a href="old.html"><span class="number">36.</span> Recently removed or moved libraries (Graphics, Bigarray, Num, LablTk)</a> </li></ul> <table class="center"><tbody><tr><td><h1 class="part" id="sec664"><span class="number">V.</span> Indexes</h1></td></tr> </tbody></table> <p> <a id="p:indexes"></a></p><ul class="ftoc2"><li class="li-links"><a href="api/index_modules.html">Index of modules</a> </li><li class="li-links"><a href="api/index_module_types.html">Index of module types</a> </li><li class="li-links"><a href="api/index_types.html">Index of types</a> </li><li class="li-links"><a href="api/index_exceptions.html">Index of exceptions</a> </li><li class="li-links"><a href="api/index_values.html">Index of values</a> </li></ul><p> <a id="section@the@hevea@index@manual.kwd"></a></p><ul> <li><a href="manual075.html">Index of keywords</a> </li></ul> <span class="authors">Xavier Leroy,<br> Damien Doligez, Alain Frisch, Jacques Garrigue, Didier Rémy and Jérôme Vouillon</span><div class="copyright">Copyright © 2025 Institut National de Recherche en Informatique et en Automatique</div></div></body></html>