package tablecloth-base

  1. Overview
  2. Docs
Native OCaml library implementing Tablecloth, a cross-platform standard library for OCaml and Rescript


Dune Dependency






Tablecloth is an ergonomic, cross-platform, standard library for use with OCaml and Rescript. It provides an easy-to-use, comprehensive and performant standard library, that has the same API on in OCaml and Rescript.

Published: 06 Jan 2024



Tablecloth is a library that shims over various standard libraries so they have the same function and module names, which using idiomatic types and patterns in each language.

This is the OCaml implementation, which uses Base, pipe-last, keyword arguments, and snake_case.

Tablecloth is alpha-quality software, and is pre-1.0. It is currently undergoing some significant shifts and some libraries listed below are not available yet. Caveat emptor.

Check out the website for our interactive API documentation, or join the community in the Tablecloth Discord.


Note: these instructions are for the upcoming new version of tablecloth

Install via opam:

opam install tablecloth-ocaml-base

Then add to your dune file:

(libraries (tablecloth-ocaml-base ...))


The recommended way to use Tablecloth is with a top-level open at the beginning of a file.

This will ensure that all the built-in modules are replaced.

open Tablecloth

let () =
  String.to_list "somestring"
  |> ~f:Char.to_code
  |> ~f:(fun x -> x+1)
  |> List.filter_map ~f:Char.from_code
  |> String.from_list

Supported versions

Tablecloth for native OCaml supports OCaml 4.08-4.14 and Base v0.12.2/v0.13.2/v0.14.3. We are open to supporting other versions:

  • OCaml 4.06 and 4.07 require small tweaks to our build system

  • Base v0.9, v0.10, and v0.11 require small code changes


When developing Tablecloth, you can test it against different versions of OCaml (native) and Base, using the following commands:

  • TC_BASE_VERSION=v0.14.0 TC_NATIVE_OCAML_SWITCH=4.11.0 make deps


The maintainers are warm and friendly, and the project abides by a Code of Conduct.

There are many small tasks to be done - a small change to a single function can be extremely helpful. We also welcome new versions of tablecloth for other languages, or even for the same language but based on other libraries.

Check out the dedicated guide on contributing for more.


Please refer to the Makefile for a complete list of supported actions. Here is a handful of useful, supported commands:

  • make deps: Install OCaml dependencies.

  • make build: Build the project.

  • make test: Run the test suite. You may need to make build first.

  • make check-format: Check your code is formatted correctly.

  • make format: Format code.

  • cd ocamldoc-json-generator && make deps && make doc: Build model.json for the website (needs to be updated and checked in whenever the APIs change.)



Tablecloth uses the MIT license.


Initially written by Darklang.

Dependencies (3)

  1. base >= "v0.12.0" & < "v0.15.0"
  2. dune >= "2.4"
  3. ocaml >= "4.08" & < "4.15"

Dev Dependencies


Used by (1)

  1. tablecloth-native >= "transition"

Conflicts (1)

  1. tablecloth-native != "transition"