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 
val repr : 'a -> t
val obj : t -> 'a
val magic : 'a -> 'b
val is_block : t -> bool
val is_int : t -> bool
val tag : t -> int
val set_tag : t -> int -> unit
val size : t -> int
val field : t -> int -> t
val set_field : t -> int -> t -> unit
val double_field : t -> int -> float
val set_double_field : t -> int -> float -> unit
val new_block : int -> int -> t
val dup : t -> t
val truncate : t -> int -> unit
val add_offset : t -> Int32.t -> t
val first_non_constant_constructor_tag : int
val last_non_constant_constructor_tag : int
val lazy_tag : int
val closure_tag : int
val object_tag : int
val infix_tag : int
val forward_tag : int
val no_scan_tag : int
val abstract_tag : int
val string_tag : int
val double_tag : int
val double_array_tag : int
val custom_tag : int
val final_tag : int
val int_tag : int
val out_of_heap_tag : int
val unaligned_tag : int
val extension_name : 'a -> string
val extension_id : 'a -> int
val extension_slot : 'a -> t

The following two functions are deprecated. Use module Marshal instead.
val marshal : t -> bytes
val unmarshal : bytes -> int -> t * int