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 Sys: sig .. end
Every function in this module raises Sys_error
with an
informative message when the underlying system call signal
an error.
val argv : string array
val executable_name : string
val file_exists : string -> bool
val is_directory : string -> bool
true
if the given name refers to a directory,
false
if it refers to another kind of file.
Raise Sys_error
if no file exists with the given name.val remove : string -> unit
val rename : string -> string -> unit
rename
may replace it, or raise an
exception, depending on your operating system.val getenv : string -> string
Not_found
if the variable is unbound.val command : string -> int
val time : unit -> float
val chdir : string -> unit
val getcwd : unit -> string
val readdir : string -> string array
"."
and ".."
in Unix) are not returned. Each string in the
result is a file name rather than a complete path. There is no
guarantee that the name strings in the resulting array will appear
in any specific order; they are not, in particular, guaranteed to
appear in alphabetical order.val interactive : bool Pervasives.ref
false
in standalone
programs and to true
if the code is being executed under
the interactive toplevel system ocaml
.val os_type : string
"Unix"
(for all Unix versions, including Linux and Mac OS X),"Win32"
(for MS-Windows, OCaml compiled with MSVC++ or Mingw),"Cygwin"
(for MS-Windows, OCaml compiled with Cygwin).val unix : bool
Sys.os_type = "Unix"
.val win32 : bool
Sys.os_type = "Win32"
.val cygwin : bool
Sys.os_type = "Cygwin"
.val word_size : int
val big_endian : bool
val max_string_length : int
val max_array_length : int
max_array_length/2
on 32-bit machines and
max_array_length
on 64-bit machines.type signal_behavior =
| |
Signal_default |
|||
| |
Signal_ignore |
|||
| |
Signal_handle of (int -> unit) |
(* | *) |
Signal_default
: take the default behavior
(usually: abort the program)Signal_ignore
: ignore the signalSignal_handle f
: call function f
, giving it the signal
number as argument.val signal : int -> signal_behavior -> signal_behavior
Invalid_argument
exception is raised.val set_signal : int -> signal_behavior -> unit
Sys.signal
but return value is ignored.val sigabrt : int
val sigalrm : int
val sigfpe : int
val sighup : int
val sigill : int
val sigint : int
val sigkill : int
val sigpipe : int
val sigquit : int
val sigsegv : int
val sigterm : int
val sigusr1 : int
val sigusr2 : int
val sigchld : int
val sigcont : int
val sigstop : int
val sigtstp : int
val sigttin : int
val sigttou : int
val sigvtalrm : int
val sigprof : int
exception Break
Sys.catch_break
is on.val catch_break : bool -> unit
catch_break
governs whether interactive interrupt (ctrl-C)
terminates the program or raises the Break
exception.
Call catch_break true
to enable raising Break
,
and catch_break false
to let the system
terminate the program on user interrupt.val ocaml_version : string
ocaml_version
is the version of OCaml.
It is a string of the form "major.minor[.patchlevel][+additional-info]"
,
where major
, minor
, and patchlevel
are integers, and
additional-info
is an arbitrary string. The [.patchlevel]
and
[+additional-info]
parts may be absent.