Standard

A portable standard library enhancement for Reason and OCaml.

Standard provides an easy-to-use, comprehensive and safe standard library that has the same API for the OCaml and Bucklescript compilers.

open Standard;
String.toList("Standard")
|> List.filterMap(~f=character =>
Char.toCode(character)
|> Int.add(1)
|> Char.ofCode
)
|> String.ofList
/* "Tuboebse" */

Portable

Works with either the Reason or OCaml syntax, targeting the Bucklescript, Native or js_of_ocaml compilers

Safe

Banish runtime errors and work effectively with Options and Results

Advanced

Index operators for Arrays, Maps, Sets and Strings plus binding operators for Options & Results mean your code is concise and expressive
open Standard
let nameToSpecies = Map.String.ofList [
("Alan", "Ant");
("Bertie", "Badger");
] in
let nameToSpecies =
nameToSpecies.Map.?{"Delilah"} <- "Duck" in
let hybrid = Option.(
let+ delilahSpecies =
nameToSpecies.Map.?{"Delilah"} in
and+ frankSpecies =
nameToSpecies.Map.?{"Frank"} |? "Cat" in
delilahSpecies ^ frankSpecies
) in
hybrid = Some "DuckCat"

Easy to learn

Excellent documentation, comprehensive examples and consistent behaviour make Standard efficient to get started with