Up Next

5.1  Built-in types and predefined exceptions

The following built-in types and predefined exceptions are always defined in the compilation environment, but are not part of any module. As a consequence, they can only be referred by their short names.

5.1.1  Predefined types

These are predefined types :

type (#'a:level) int
The type of integer numbers.

type (#'a:level) int32
The type of 32 bits integer numbers.

type (#'a:level) int64
The type of 64 bits integer numbers.

type (#'a:level) nativeint
The type of processor-native integer numbers.

type (#'a:level) char
The type of characters.

type (#'a:level) string
The type of immutable strings.

type (='a:level, #'b:level) charray
The type of mutable character strings.

type (#'a:level) float
The type of floating-point numbers.

type (#'a:level) bool
The type of booleans (truth values).

type noneq unit = ()
The type of the unit value.

type (+'a:type, #'b:level) array
The type of arrays whose elements have type 'a.

type (+'a:type, #'b:level) list = [] | :: of 'a * ('a, 'b) list # 'b
The type of lists whose elements have type 'a.

type (+'a:type, #'b:level) option = None | Some of 'a # 'b
The type of optional values.

5.1.2  Exceptions


These are predefined exceptions :

exception Invalid_argument : 'a of 'a stg
Exception raised by library functions to signal that the given arguments do not make sense. (For compatibility reasons with the Objective Caml library, this exception is uncatchable for some particular values of its string argument.)

exception Failure : 'a of 'a stg
Exception raised by library functions to signal that they are undefined on the given arguments. (For compatibility reasons with the Objective Caml library, this exception is uncatchable for some particular values of its string argument.)

exception Not_found
Exception raised by search functions when the desired object could not be found.

exception End_of_file
Exception raised by input functions to signal that the end of file has been reached.

exception Division_by_zero
Exception raised by division and remainder operations when their second argument is null.



Up Next