Interface that should support any regular data type.
Overview
A regular type is catch all term for all data types that are regular, like numbers, characters, strings and their algebraic closure. A proper term for such types would be inductive types. A regular type always has a concrete representation, it is printable, comparable (with total order), hashable, etc.
To contrast, functions, closures, proxies, descriptors, and any co-inductive types are non-regular. The main difference, is that regular type is self contained, where non-regular types, usually represent something that can be only observed, but not really represented with the data type.
On the border line we have Opaque
data types. These are types, that pretend to be Regular
, but we can't actually inspect their representation.
Features
So what the library actually provides. First of all it defines the Regular
interface, that each regular data type is expected to implement. This includes a full set of Io
functions, that allows one to read, write and serialize values of the type (see Data
interface). It also provides an inteface for creating different collections from the values of that type, including trees, hashtables, maps, sets, etc. Also, it describes the whole algebra of comparison functions. For the opaque data types an interface called Opaque
is provided, that is a proper subset of the Regular
. It doesn't provide printing and serialization, but has everything that can be derived for a type with a total order (e.g., containers, comparison function, etc).
A functor is provided for each interface, that requires the minimal implementation, and derives the rest.
Finally, a Bytes
module is provided that facilitates the transfer from mutable to immutable Strings
. It is the extension of OCaml standard Bytes module, enhanced with the expected set of functions.
Type definitions
bytes is a mutable sequence of bytes that has a fixed length.
val bin_bytes : bytes Core_kernel.Bin_prot.Type_class.t
val bin_read_bytes : bytes Core_kernel.Bin_prot.Read.reader
val __bin_read_bytes__ : (int -> bytes) Core_kernel.Bin_prot.Read.reader
val bin_reader_bytes : bytes Core_kernel.Bin_prot.Type_class.reader
val bin_size_bytes : bytes Core_kernel.Bin_prot.Size.sizer
val bin_write_bytes : bytes Core_kernel.Bin_prot.Write.writer
val bin_writer_bytes : bytes Core_kernel.Bin_prot.Type_class.writer
val bin_shape_bytes : Core_kernel.Bin_prot.Shape.t
val bytes_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> bytes
val sexp_of_bytes : bytes -> Ppx_sexp_conv_lib.Sexp.t
Reader and Writer type classes
Each type class is an abstraction of a tuple of function.
an interface for reading a value from the input.
an interface for writing a value to the output.
a string that digests data
val bin_digest : digest Core_kernel.Bin_prot.Type_class.t
val bin_read_digest : digest Core_kernel.Bin_prot.Read.reader
val __bin_read_digest__ : (int -> digest) Core_kernel.Bin_prot.Read.reader
val bin_reader_digest : digest Core_kernel.Bin_prot.Type_class.reader
val bin_size_digest : digest Core_kernel.Bin_prot.Size.sizer
val bin_write_digest : digest Core_kernel.Bin_prot.Write.writer
val bin_writer_digest : digest Core_kernel.Bin_prot.Type_class.writer
val bin_shape_digest : Core_kernel.Bin_prot.Shape.t
val digest_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> digest
val sexp_of_digest : digest -> Ppx_sexp_conv_lib.Sexp.t
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
'a printer
constructs a printer type for arbitrary type 'a
.
A value of type 'a printer
is a function that is expected by the %a
specifier of the Format.printf
family of functions.
Printable data structures.
Abbreviation for 'a Sequence.t
val bin_seq :
'a Core_kernel.Bin_prot.Type_class.t ->
'a seq Core_kernel.Bin_prot.Type_class.t
val bin_read_seq :
'a Core_kernel.Bin_prot.Read.reader ->
'a seq Core_kernel.Bin_prot.Read.reader
val __bin_read_seq__ :
'a Core_kernel.Bin_prot.Read.reader ->
(int -> 'a seq) Core_kernel.Bin_prot.Read.reader
val bin_reader_seq :
'a Core_kernel.Bin_prot.Type_class.reader ->
'a seq Core_kernel.Bin_prot.Type_class.reader
val bin_size_seq :
'a Core_kernel.Bin_prot.Size.sizer ->
'a seq Core_kernel.Bin_prot.Size.sizer
val bin_write_seq :
'a Core_kernel.Bin_prot.Write.writer ->
'a seq Core_kernel.Bin_prot.Write.writer
val bin_writer_seq :
'a Core_kernel.Bin_prot.Type_class.writer ->
'a seq Core_kernel.Bin_prot.Type_class.writer
val bin_shape_seq :
Core_kernel.Bin_prot.Shape.t ->
Core_kernel.Bin_prot.Shape.t
val compare_seq : ('a -> 'a -> int) -> 'a seq -> 'a seq -> int
val seq_of_sexp :
(Ppx_sexp_conv_lib.Sexp.t -> 'a) ->
Ppx_sexp_conv_lib.Sexp.t ->
'a seq
val sexp_of_seq :
('a -> Ppx_sexp_conv_lib.Sexp.t) ->
'a seq ->
Ppx_sexp_conv_lib.Sexp.t
val (^::) : 'a -> 'a seq -> 'a seq
x ^:: xs
is a consing operator for sequences
module Data : sig ... end
Data types support module.
Regular types models a general concept of value, i.e., something that can be used in way similar to regular int
, string
, char
and other built in types. So that it can be compared, used in maps, sets, hashtables, printer, etc.
Opaque type is like regular type, except that we can print or examine it in any way. So it can't be serialized or pretty-printed. An Opaque.Make
can create an instances of such type.
module Bytes : sig ... end
Extension of the standard bytes module.