Tablecloth

A standard library with the same API in Rescript, OCaml and F#

Tablecloth provides an easy-to-use, comprehensive, and safe standard library that has the same API across multiple languages (OCaml, Rescript, and F#).

open Tablecloth;
String.toList("Tablecloth")
|> List.filterMap(character =>
Char.toCode(character)
->Int.add(1)
->Char.fromCode
)
|> String.fromList

Easy to learn

Excellent documentation, comprehensive examples and consistent behaviour make Tablecloth simple to learn and easy to get started with

Portable yet idiomatic

Use the same API in multiple languages (OCaml, Rescript, and F#), while adapting to each language's best practices. Tablecloth is built on top of standard libraries so it interacts seamlessly with the host language. Whether pipe-first or pipe-last, camelCase or snakeCase, labelled arguments or no, Tablecloth is designed to feel at home in each language.
rescript
let name = Some("Kubo")
let species = Some("dog")
let favoriteGame = None;
let bio = Option.({
let (name, species) = Option.both(name, species)
name ++ " the " ++ "'s favorite game is" ++ (favoriteGame |? "fetch")
})

Safe

Tablecloth avoids runtime exceptions, relying on Options and Results instead.