Standard OCaml Library - Stdlib

The Stdlib standard library provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and standard library modules.

The Stdlib API is available at ocaml-base-compiler/stdlib/Stdlib/.

In conventional OCaml programs the Stdlib is automatically opened. That means you can type print_endline "Hi" rather than Stdlib.print_endline "Hi". However, in DkCoder access to the Stdlib is restricted: Stdlib does a bit too much. In particular, input-output channels and threading do not make sense when compiling to JavaScript for use on a web page. Even more critical is that the Stdlib.Obj module is included, which has unsafe functions that make it impossible to prove overall code safety.

You can explicitly get back the unsafe standard library by performing an open at the top of your scripts:

open Tr1Stdlib_V414All

However, it is recommended to open the pieces of the standard library you actually need with the Partitioned Standard Library like open Tr1Stdlib_V414Base. That way if, for example, your script does not read or write local files it can be compiled to JavaScript.