Module Conex_utils
String, unsigned integers, logging, collections, and more
Sets, Maps, List utils
module S : sig ... end
S
is a string set.
module M : sig ... end
M
is aMap
which keys are strings.
Format
val pp_list : 'a fmt -> 'a list fmt
pp_list pp
is a pretty printer for a list (surrounded by square brackets, elements are separated by semicolon). Thepp
is be a pretty printer for list elements.
val str_pp : 'a fmt -> 'a -> string
str_pp pp a
results in a string applying the pretty-printer to the value.
Result combinators
val (>>=) : ('a, 'b) Stdlib.result -> ('a -> ('c, 'b) Stdlib.result) -> ('c, 'b) Stdlib.result
r >>= f
isf a
unlessr
is anError
, which is propagated. Monadic bind.
val guard : bool -> 'a -> (unit, 'a) Stdlib.result
guard pred err
is eitherOk ()
(ifpred
holds),Error err
otherwise.
val foldM : ('a -> 'b -> ('a, 'c) Stdlib.result) -> 'a -> 'b list -> ('a, 'c) Stdlib.result
foldM f a xs
appliesf
to each element ofxs
, returns eitherOk
and the produced value, orError
.
val iterM : ('a -> (unit, 'b) Stdlib.result) -> 'a list -> (unit, 'b) Stdlib.result
iterM f xs
appliesf
to each element ofxs
, returns eitherOk
and the produced value, orError
.
val foldS : ('a -> string -> ('a, 'c) Stdlib.result) -> 'a -> S.t -> ('a, 'c) Stdlib.result
foldS f a s
appliesf
to each element of the sets
, returns eitherOk
and the produced value, orError
.
String
Unsigned integers
module Uint_map : sig ... end
Uint_map
is aMap
which keys are Uint.t.
Logging
File system types
val root : path
root
is the root path.
val path_to_string : path -> string
path_to_string path
is String.concat"/" path
.- raises [Invalid_argument]
if
path
includes either "." or "..".
val string_to_path : string -> (path, string) Stdlib.result
string_to_path str
is String.cuts"/" str
and ensuring no empty segments, ".", or ".." be present. Ifstr
contains a leading "/", it is discarded.
val string_to_path_exn : string -> path
string_to_path_exb str
is String.cuts"/" str
and ensuring no empty segments, ".", or ".." be present. Ifstr
contains a leading "/", it is discarded.- raises [Invalid_argument]
if
path
is invalid.
val subpath : parent:path -> path -> bool
subpath ~parent p
istrue
ifp
starts with all segments ofparent
.
type item
= file_type * string
An
item
is a type and its payload
Tree
module Tree : sig ... end
Tree
is a simple tree datatype, edge is astring
, values are'a lists
.