module Structural_descr: sig
.. end
Internal representations of OCaml type as first class values. These values
are called structural descriptors.
Since Carbon-20101201
Type declarations
type
recursive
type
single_pack = Unmarshal.t
Please consider that this type is private. It is not only for compatibility
with OCaml 3.10.2. It MUST NOT be used directly in any case.
type
pack =
Structural descriptor used inside structural descriptor.
type
t =
Type of internal representations of OCaml type.
Example: the structural descriptor of A | B of int * bool | C of string
is Structure (Sum [| [| p_int; p_bool |]; [| p_string |] |])
. Ok, in
this case, just Abstract
is valid too.
type
structure =
| |
Sum of pack array array |
| |
Array of pack |
Description with details.
Useful functions
val pack : t -> pack
Pack a structural descriptor for embedding inside another one.
module Recursive: sig
.. end
Use this module for handling a (possibly recursive) structural descriptor
d
.
Predefined descriptors
val t_unit : t
val t_int : t
val t_string : t
val t_float : t
val t_bool : t
val t_int32 : t
val t_int64 : t
val t_nativeint : t
val t_record : pack array -> t
val t_tuple : pack array -> t
val t_list : t -> t
val t_ref : t -> t
val t_option : t -> t
val t_array : t -> t
val t_queue : t -> t
Use the below functions only if the compare/hash functions cannot change by
marshalling.
val t_set_unchanged_compares : t -> t
val t_map_unchanged_compares : t -> t -> t
val t_hashtbl_unchanged_hashs : t -> t -> t
Packed versions of predefined descriptors.
val p_abstract : pack
equivalent to pack Abstract
val p_unit : pack
val p_int : pack
val p_string : pack
val p_float : pack
val p_bool : pack
val p_int32 : pack
val p_int64 : pack
val p_nativeint : pack
Internals
These values must be used only inside the Type library.
exception Cannot_pack
val unsafe_pack : Unmarshal.t -> pack
Raises Cannot_pack
if packing failed.
val cleanup : t -> t
val are_consistent : t -> t -> bool