package octez-proto-libs
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V10/Make/Compare/index.html
Module Make.CompareSource
Compare
Monomorphic comparison for common ground types and common type constructors.
Compare provides a module signature for the standard comparison functions and operators as well as modules of that signature for the common OCaml ground types (int, bool, etc.) and type constructors (list, option, etc.).
Compare also provides some additional helpers for comparison-related tasks.
Signatures and a functor
module type COMPARABLE = sig ... endmodule type S = sig ... endS is a signature for a fully-fledge comparison module. It includes all the functions and operators derived from a compare function.
Base types
The specialised comparison and all the specialised functions and operators on the base types are compatible with the polymorphic comparison and all the polymorphic functions and operators from the Stdlib.
module Int : sig ... endInt is a comparison module. Out of performance concerns, the signature actually contains compiler builtins (external) rather than val.
Type constructors
Provided the functor argument(s) are compatible with the polymorphic comparison of the Stdlib, then the specialised comparison and all the specialised functions and operators on the derived types are compatible with the polymorphic comparison and all the polymorphic functions and operators from the Stdlib.
module Result
(Ok : COMPARABLE)
(Error : COMPARABLE) :
S with type t = (Ok.t, Error.t) Pervasives.resultList lengths
Helpers for more readable Stdlib.List.compare_lengths and Stdlib.List.compare_length_with.
These modules are intended to be used as Module.(expression), most often within an if condition. E.g.,
if Compare.List_length_with.(chunks > max_number_of_chunks) then
raise Maximum_size_exceeded
else
..module List_length_with : sig ... endmodule List_lengths : sig ... end