Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Fully qualified names.
type t = name
include Core_kernel.Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val create : ?package:string -> string -> t
create ?package name
creates a fully qualified name.
The package
and name
strings can contain any characters all treated literally, e.g., the :
character won't be treated as a separator neither it will break anything.
If package
is not specified, then it defaults to the "user"
package.
val read : ?package:string -> string -> t
read ?package input
reads a full name from input.
This function will parse the input
and return a fully-qualified name that corresponds to the input, using package
as the currently opened package. The input syntax is
name = string, ":", string | ":", string | string string = ?a sequence of any characters?
Not all characters in the input
string are treated literally, the following two characters have a special interpretation:
'\\'
the escape character;':'
the package separator character.The escape character disables a special interpretation of the consequent character. The package separator denotes the place in the input where the package name ends and the name part starts.
If package
is specified then it is treated literally (as in the create
function). The same as in create
it defaults to the "user"
package.
If input
doesn't denote a fully qualified name (i.e., there is no ':'
special character in input
, then the read name is qualified with the passed package
, otherwise the package is defined by the input
.
The function is expected to work with the output of the show
function, so that for all n
, read (show n) = n
. However, it is robust enough to accept any user inputs, even if it is not a well-formed input, e.g., when an escape character is used to escaped a non-special character or when input contains more than one unescaped separators. In case of invalid input, all special characters that doesn't make sense are treated literally and the first special ':'
denotes the end of the package field. If the input is not valid, then it is possible that show (read s) <> s
, since the output of show
is always valid, e.g.
show@@read "hello:cruel:world" = "hello:cruel\\:world"
val show : t -> string
show name
is the readable representation of name
.
The name is represented as <package>:<name>
, with all special characters escaped. See the read
function for more information.
val unqualified : t -> string
unqualified name
is the unqualified name.
Returns the name without the package specifier.
val package : t -> string
package name
is the package of the name
.
val str : unit -> t -> string
str () x = show x
shows x
.
This function is useful with printf-style functions that output to a string.
val hash : t -> int
hash name
the name
hash.
include Base.Comparable.S with type t := t
include Base.Comparisons.S with type t := t
compare t1 t2
returns 0 if t1
is equal to t2
, a negative integer if t1
is less than t2
, and a positive integer if t1
is greater than t2
.
ascending
is identical to compare
. descending x y = ascending y x
. These are intended to be mnemonic when used like List.sort ~compare:ascending
and List.sort
~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.
clamp_exn t ~min ~max
returns t'
, the closest value to t
such that between t' ~low:min ~high:max
is true.
Raises if not (min <= max)
.
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_bound :
min:t Base.Maybe_bound.t ->
max:t Base.Maybe_bound.t ->
t Base.Validate.check
include Core_kernel.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
This function only needs implementation if t
exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t
afterwards.
val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t
include Core_kernel.Stringable.S with type t := t
val of_string : string -> t
val to_string : t -> string
include Core_kernel.Pretty_printer.S with type t := t
val pp : Base.Formatter.t -> t -> unit