Up

module Type_struct

: sig
#
module Name : sig
#
type t = int
include Pre_core.Std.Hashable.S with type key := t
#
val make_fresh : unit -> unit -> t
#
val bin_t : t Bin_prot.Type_class.t
#
val bin_read_t : t Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
#
val bin_reader_t : t Bin_prot.Type_class.reader
#
val bin_size_t : t Bin_prot.Size.sizer
#
val bin_write_t : t Bin_prot.Write.writer
#
val bin_writer_t : t Bin_prot.Type_class.writer
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Variant : sig
#
module Kind : sig
#
type t =
# | Polymorphic
# | Usual
#
val is_polymorphic : t -> bool
#
val equal : t -> t -> bool
#
val bin_t : t Bin_prot.Type_class.t
#
val bin_read_t : t Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
#
val bin_reader_t : t Bin_prot.Type_class.reader
#
val bin_size_t : t Bin_prot.Size.sizer
#
val bin_write_t : t Bin_prot.Write.writer
#
val bin_writer_t : t Bin_prot.Type_class.writer
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
type t = {
# label
: string;
# index
: int;
# ocaml_repr
: int;
}
#
val label : t -> string
#
val index : t -> int
#
val ocaml_repr : t -> int
#
module Option : sig
#
val some : t
#
val none : t
end
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Variant_infos : sig
#
type t = {
# kind
: Variant.Kind.t;
}
#
val equal : t -> t -> bool
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Field : sig
#
type t = {
# label
: string;
# index
: int;
}
#
val label : t -> string
#
val index : t -> int
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Record_infos : sig
#
type t = {
# has_double_array_tag
: bool;
}
#
val equal : t -> t -> bool
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
type t =
# | Int
# | Int32
# | Int64
# | Nativeint
# | Char
# | Float
# | String
# | Bool
# | Unit
# | Option of t
# | List of t
# | Array of t
# | Lazy of t
# | Ref of t
# | Tuple of t Pre_core.Std.Farray.t
# | Record of Record_infos.t * (Field.t * t) Pre_core.Std.Farray.t
# | Variant of Variant_infos.t * (Variant.t * t Pre_core.Std.Farray.t) Pre_core.Std.Farray.t
# | Named of Name.t * t option
#
type type_struct = t
#
val get_variant_by_repr : Variant_infos.t -> (Variant.t * t Pre_core.Std.Farray.t) Pre_core.Std.Farray.t -> int -> (Variant.t * t Pre_core.Std.Farray.t) option
#
val get_variant_by_label : Variant_infos.t -> (Variant.t * t Pre_core.Std.Farray.t) Pre_core.Std.Farray.t -> string -> (Variant.t * t Pre_core.Std.Farray.t) option
#
val variant_args_of_type_struct : arity:int -> t -> t Pre_core.Std.Farray.t
#
val type_struct_of_variant_args : t Pre_core.Std.Farray.t -> t
#
val option_as_variant : some:t -> Variant_infos.t * (Variant.t * t Pre_core.Std.Farray.t) Pre_core.Std.Farray.t
#
val incompatible : unit -> t
#
val alpha_conversion : t -> t
#
val has_named : t -> bool
#
val standalone_exn : readonly:t Name.Table.t -> t -> t

re put at least one Named let binding for each named used in the structure so that the structure is self contained, and not depend on table anymore. This is needed especially if the structure has to go outside and be given to some other part of the world

#
val reduce : t -> t
#
val are_equivalent : t -> t -> bool

This compare is insensible to alpha conversion of cycle indexes, as well as reduction. The polymorphic compare may be wrong for equivalent structures. See also alpha_conversion or reduce if needed.

This function considers equivalent polymorphic variants with different order of fields, as long as the order of cases is the only difference.

#
val least_upper_bound_exn : t -> t -> t

merge two types by regrouping the polymorphic variants, if this can be done. if this cannot be done, this raises with a reason for the error, in the hope that this information could be seen by an human, like a compiler type error message.

#
val is_polymorphic_variant : t -> bool
#
module type Typestructable = sig
#
type t
#
val typestruct_of_t : type_struct
end
#
module Generic : Typerep_lib.Std.Type_generic.S with type 'a t = t
#
val of_typerep : 'a Typerep_lib.Std.Typerep.t -> t
#
val to_typerep : t -> Typerep_lib.Std.Typerep.packed

This generates new uniq Names for the type present in the structure. In particular, behavior overrides done via the generic registering mechanism will not occur when working out of the returned type_rep.

#
val sexp_of_typerep : _ Typerep_lib.Std.Typerep.t -> Pre_core.Std.Sexp.t
#
module Diff : sig

Diff offers a way to know given two type structures if their bin_io representation would be compatible. If not, the difference between the structure is computed and can be given as part as an error message.

Diff.t is *NOT* stable. It does not support with bin_io on purpose, not any guarantee is given about the type of diffs : it may arbitrarily change in any further version. Consider that serializing it as an Sexp.t with the only aim being to log it somewhere for a human to read is the *only* reasonable thing to do with a Diff.t over the wire.

#
type t
#
val is_empty : t -> bool
#
val compute : type_struct -> type_struct -> t
#
val is_bin_prot_subtype : subtype:type_struct -> supertype:type_struct -> bool
#
val incompatible_changes : t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
#
module Versioned : sig
#
type t
#
val typerep_of_t : t Typerep_lib.Std.Typerep.t
#
val typename_of_t : t Typerep_lib.Std.Typename.t
#
module Version : sig
#
type t
#
val typerep_of_t : t Typerep_lib.Std.Typerep.t
#
val typename_of_t : t Typerep_lib.Std.Typename.t
#
val v1 : t
#
val v2 : t
#
val v3 : t
#
val v4 : t
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Bin_prot.Type_class.t
#
val bin_read_t : t Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
#
val bin_reader_t : t Bin_prot.Type_class.reader
#
val bin_size_t : t Bin_prot.Size.sizer
#
val bin_write_t : t Bin_prot.Write.writer
#
val bin_writer_t : t Bin_prot.Type_class.writer
end
#
val version : t -> Version.t
#
val unserialize : t -> type_struct
#
exception Not_downgradable of Pre_core.Std.Sexp.t

may raise iif the current value is not_downgradable. (use of new feature)

#
val serialize : version:Version.t -> type_struct -> t
#
val change_version : version:Version.t -> t -> t
#
module Diff : sig
#
val compute : t -> t -> Diff.t
#
val is_bin_prot_subtype : subtype:t -> supertype:t -> bool
end
#
val is_polymorphic_variant : t -> bool
#
val least_upper_bound_exn : t -> t -> t
#
val to_typerep : t -> Typerep_lib.Std.Typerep.packed
#
val of_typerep : version:Version.t -> _ Typerep_lib.Std.Typerep.t -> t
#
val t_of_sexp : Sexplib.Sexp.t -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
#
val bin_t : t Bin_prot.Type_class.t
#
val bin_read_t : t Bin_prot.Read.reader
#
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
#
val bin_reader_t : t Bin_prot.Type_class.reader
#
val bin_size_t : t Bin_prot.Size.sizer
#
val bin_write_t : t Bin_prot.Write.writer
#
val bin_writer_t : t Bin_prot.Type_class.writer
end
#
class traverse :
#
method iter : t -> unit
#
method map : t -> t
#
module Named_utils : functor (X : sig
#
type t
#
class traverse :
#
method iter : t -> unit
#
method map : t -> t
#
val match_named : t -> [
| `Named of Name.t * t option
| `Other of t
]
#
val cons_named : Name.t -> t option -> t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end
) -> sig
#
val has_named : X.t -> bool
#
val alpha_conversion : X.t -> X.t
#
val standalone_exn : readonly:X.t Name.Table.t -> X.t -> X.t
end
#
type 'a typed_t = t
#
val recreate_dynamically_typerep_for_test : 'a Typerep_lib.Std.Typerep.t -> 'a Typerep_lib.Std.Typerep.t
#
val sexp_of_t : t -> Sexplib.Sexp.t
end