Module Bin_prot__Shape
include Bin_shape_lib.Std.Shape
type t
Shape.t
are constructed by thebin_shape
syntax extension from Ocaml type definitions & expressions.There is a direct mapping from ocaml type definition syntax to the corresponding
Shape.group
and from ocaml type expression syntax to the correspondingShape.t
.
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
module Tid = Bin_shape_lib.Bin_shape.Tid
module Vid = Bin_shape_lib.Bin_shape.Vid
module Location = Bin_shape_lib.Bin_shape.Location
Location.t
is required when constructing shapes for which evaluation might fail.
module Uuid = Bin_shape_lib.Bin_shape.Uuid
Uuid.t
is used bybasetype
andannotate
.
val group : Location.t -> (Tid.t * Vid.t list * t) list -> group
This function is generative; repeated calls create distinct groups
val constr : string -> t option -> poly_variant_row
val inherit_ : Location.t -> t -> poly_variant_row
val poly_variant : Location.t -> poly_variant_row list -> t
val rec_app : Tid.t -> t list -> t
recursive apps within the current group
val var : Location.t -> Vid.t -> t
val basetype : Uuid.t -> t list -> t
Built-in types and types with custom serialization: i.e. int,list,... To avoid accidental protocol compatibility, pass a UUID as the
string
argument
module Digest = Bin_shape_lib.Bin_shape.Digest
module Canonical = Bin_shape_lib.Bin_shape.Canonical
val eval : t -> Canonical.t
eval t
returns the canonical-shape for a shape-expressionShape.t
. Type aliases are expanded, so that noTid.t
orVid.t
have significance in the resulting canonical-shape. Type-recursion, including non-regular recursion, is translated to the de-bruijn representation used in canonical-shapes.
val eval_to_digest : t -> Digest.t
eval_to_digest t
returns a hash-value direct from theShape.t
, potentially avoiding the intermediateCanonical.t
from being constructed. This is important as the size of a canonical-shape might be exponential in terms of the size of the shape expression. The following holds:Digest.(eval_to_digest exp = Canonical.to_digest (eval exp))
val eval_to_digest_string : t -> string
eval_to_digest_string t
==Digest.to_hex (eval_to_digest t)
Convenience function useful for writing unit tests.
module For_typerep = Bin_shape_lib.Bin_shape.For_typerep
val bin_shape_unit : t
val bin_shape_bool : t
val bin_shape_string : t
val bin_shape_bytes : t
val bin_shape_char : t
val bin_shape_float : t
val bin_shape_int : t
val bin_shape_int32 : t
val bin_shape_int63 : t
val bin_shape_int64 : t
val bin_shape_nativeint : t
val bin_shape_nat0 : t
val bin_shape_digest : t
val bin_shape_float32_vec : t
val bin_shape_float64_vec : t
val bin_shape_vec : t
val bin_shape_float32_mat : t
val bin_shape_float64_mat : t
val bin_shape_mat : t
val bin_shape_bigstring : t
val bin_shape_variant_int : t
val bin_shape_int_8bit : t
val bin_shape_int_16bit : t
val bin_shape_int_32bit : t
val bin_shape_int_64bit : t
val bin_shape_int64_bits : t
val bin_shape_network16_int : t
val bin_shape_network32_int : t
val bin_shape_network32_int32 : t
val bin_shape_network64_int : t
val bin_shape_network64_int64 : t
val bin_shape_ref : t -> t
val bin_shape_option : t -> t
val bin_shape_list : t -> t
val bin_shape_array : t -> t
val bin_shape_hashtbl : t -> t -> t
val bin_shape_float_array : t
val bin_shape_lazy : 'a -> 'a
val bin_shape_pair : t -> t -> t
val bin_shape_triple : t -> t -> t -> t