Bindoj_typedesc.Type_desc
This module provides functionalities to describe the types used in Bindoj.
type ('pos, 'kind) config = .. constraint 'pos = [< pos ]
Configuration type where 'pos is restricted to pos types.
module Configs : sig ... end
This module provides the functionality of configurations. Contains types and functions for handling configurations.
val pp_configs : _ -> Kxclib.ppf -> _ configs -> unit
dummy printer. always prints "<configs>".
module Coretype : sig ... end
This module provides functionalities to handle core types.
type coretype = Coretype.t
val pp_coretype : Kxclib.ppf -> coretype -> unit
Pretty printer for the coretype
.
val string_of_coretype : coretype -> string
type record_field = {
rf_name : string;
Name of the record field
*)rf_type : [ `direct of coretype | `nested of type_decl * Coretype.codec ];
Type of the record field
*)rf_configs : [ `record_field ] configs;
Configurations associated with the record field
*)rf_doc : Bindoj_runtime.doc;
Documentation of the record field
*)}
Represents a record field.
and variant_tuple_argument = {
va_type : [ `direct of coretype | `nested of type_decl * Coretype.codec ];
va_configs : [ `variant_tuple_argument ] configs;
va_doc : Bindoj_runtime.doc;
}
and variant_constructor = {
vc_name : string;
Name of the variant constructor
*)vc_param : [ `no_param
| `tuple_like of variant_tuple_argument list
| `inline_record of record_field list
| `reused_inline_record of type_decl ];
vc_configs : [ `variant_constructor ] configs;
Configurations associated with the variant constructor
*)vc_doc : Bindoj_runtime.doc;
Documentation of the variant constructor
*)}
Represents a variant constructor.
and type_decl_kind =
| Alias_decl of coretype
Type alias kind
*)| Record_decl of record_field list
Record type kind
*)| Variant_decl of variant_constructor list
Variant type kind
*)Describe the kind of a type declaration.
and type_decl = {
td_name : string;
Name of the type declaration
*)td_configs : [ `type_decl ] configs;
Configurations associated with the type declaration
*)td_kind : type_decl_kind;
Kind of the type declaration
*)td_doc : Bindoj_runtime.doc;
Documentation of the type declaration
*)}
Represents a type declaration.
val pp_record_field : Kxclib.ppf -> record_field -> unit
Pretty printer for the record_field
.
val string_of_record_field : record_field -> string
val equal_record_field : record_field -> record_field -> bool
Checks equality of two record_fields.
val record_field :
?doc:Bindoj_runtime.doc ->
?configs:[ `record_field ] configs ->
string ->
coretype ->
record_field
Creates a new record_field
backed by a coretype
.
val record_field_nested :
?doc:Bindoj_runtime.doc ->
?configs:[ `record_field ] configs ->
?codec:Coretype.codec ->
string ->
type_decl ->
record_field
Creates a new record_field
backed by another type_decl
.
val variant_argument :
?doc:Bindoj_runtime.doc ->
?configs:[ `variant_tuple_argument ] configs ->
coretype ->
variant_tuple_argument
Creates a new argument type specification backed by a coretype
for a position in a variant constructor that takes tuple-like arguments.
val variant_argument_nested :
?doc:Bindoj_runtime.doc ->
?configs:[ `variant_tuple_argument ] configs ->
?codec:Coretype.codec ->
type_decl ->
variant_tuple_argument
Creates a new argument type specification backed by a type_decl
for a position in a variant constructor that takes tuple-like arguments.
val pp_variant_constructor : Kxclib.ppf -> variant_constructor -> unit
Pretty printer for the variant_constructor
.
val string_of_variant_constructor : variant_constructor -> string
val equal_variant_constructor :
variant_constructor ->
variant_constructor ->
bool
Checks equality of two variant_constructors.
val variant_constructor :
?doc:Bindoj_runtime.doc ->
?configs:[ `variant_constructor ] configs ->
string ->
[ `no_param
| `tuple_like of variant_tuple_argument list
| `inline_record of record_field list
| `reused_inline_record of type_decl ] ->
variant_constructor
Creates a new variant_constructor
val pp_type_decl : Kxclib.ppf -> type_decl -> unit
Pretty printer for the type_decl
.
val string_of_type_decl : type_decl -> string
type config +=
| Config_caml_variant_type : variant_type -> ([ `type_decl ],
[ `caml_variant_type ])
config
Configuration for the Caml variant type.
*)module Caml_config : sig ... end
This module provides functionalities to handle configs of OCaml.
val alias_decl :
?doc:Bindoj_runtime.doc ->
?configs:[ `type_decl ] configs ->
string ->
coretype ->
type_decl
Creates a new type_decl
of type_decl_kind.Alias_decl
.
val record_decl :
?doc:Bindoj_runtime.doc ->
?configs:[ `type_decl ] configs ->
string ->
record_field list ->
type_decl
Creates a new type_decl
of type_decl_kind.Record_decl
.
val variant_decl :
?variant_type:variant_type ->
?doc:Bindoj_runtime.doc ->
?configs:[ `type_decl ] configs ->
string ->
variant_constructor list ->
type_decl
Creates a new type_decl
of type_decl_kind.Variant_decl
.
type ancestral_configs =
[ `alias of [ `type_decl ] configs
| `record_field of [ `type_decl ] configs * [ `record_field ] configs
| `variant_field of
[ `type_decl ] configs
* [ `variant_constructor ] configs
* [ `record_field ] configs
| `variant_reused_field of
[ `type_decl ] configs
* [ `variant_constructor ] configs
* [ `type_decl ] configs
* [ `record_field ] configs
| `variant_argument of
int
* [ `type_decl ] configs
* [ `variant_constructor ] configs
* [ `variant_tuple_argument ] configs ]
list
List of kind and configs of type_decl, the parent of the coretype. The format of the list is path, with head being the closest.
val fold_coretypes' :
('a -> (coretype * ancestral_configs) -> 'a) ->
'a ->
type_decl ->
'a