Quick StartTryGuideAPICommunityBlogGitHub

Standard Library

Below is the API for the OCaml standard library. It's directly copied over from the OCaml Manual, formatted to the Reason syntax and styled accordingly. The API docs are work-in-progress; we'll be polishing these gradually!

If you're targeting JavaScript, the API docs for BuckleScript includes all of below, plus JS-specific APIs.

Module Obj

module Obj: sig .. end
Operations on internal representations of values.

Not for the casual user.

type t;
let repr: 'a => t;
let obj: t => 'a;
let magic: 'a => 'b;
let is_block: t => bool;
let is_int: t => bool;
let tag: t => int;
let set_tag: (t, int) => unit;
let size: t => int;
let field: (t, int) => t;
let set_field: (t, int, t) => unit;
let double_field: (t, int) => float;
let set_double_field: (t, int, float) => unit;
let new_block: (int, int) => t;
let dup: t => t;
let truncate: (t, int) => unit;
let add_offset: (t, Int32.t) => t;
let first_non_constant_constructor_tag: int;
let last_non_constant_constructor_tag: int;
let lazy_tag: int;
let closure_tag: int;
let object_tag: int;
let infix_tag: int;
let forward_tag: int;
let no_scan_tag: int;
let abstract_tag: int;
let string_tag: int;
let double_tag: int;
let double_array_tag: int;
let custom_tag: int;
let final_tag: int;
let int_tag: int;
let out_of_heap_tag: int;
let unaligned_tag: int;
let extension_name: 'a => string;
let extension_id: 'a => int;
let extension_slot: 'a => t;

The following two functions are deprecated. Use module Marshal instead.
let marshal: t => bytes;
let unmarshal: (bytes, int) => (t, int);