Module Conex_utils

module Conex_utils: sig .. end
String, unsigned integers, logging, collections, and more


Sets, Maps, List utils


module S: Set.S  with type elt = string
S is a string set.
val s_of_list : string list -> S.t
s_of_list xs transforms the string list xs to a set.
module M: Map.S  with type key = string
M is a Map which keys are strings.
val filter_map : f:('a -> 'b option) -> 'a list -> 'b list
filter_map f xs is xs', a list which contains all elements where f resulted in Some _.

Result combinators


val (>>=) : ('a, 'b) Pervasives.result ->
('a -> ('c, 'b) Pervasives.result) -> ('c, 'b) Pervasives.result
r >>= f is f a unless r is an Error, which is propagated. Monadic bind.
val guard : bool -> 'a -> (unit, 'a) Pervasives.result
guard pred err is either Ok () (if pred holds), Error err otherwise.
val foldM : ('a -> 'b -> ('a, 'c) Pervasives.result) ->
'a -> 'b list -> ('a, 'c) Pervasives.result
foldM f a xs applies f to each element of xs, returns either Ok and the produced value, or Error.
val foldS : ('a -> string -> ('a, 'c) Pervasives.result) ->
'a -> S.t -> ('a, 'c) Pervasives.result
foldS f a s applies f to each element of the set s, returns either Ok and the produced value, or Error.

String


module String: sig .. end
Some String utilities implemented here to avoid external dependencies.

Unsigned integers


module Uint: sig .. end
64 bit unsigned integer with explicit overflow behaviour (see Conex_utils.Uint.succ).

Logging


module type LOGS = sig .. end
LOGS is a subset of the Logs library, providing four log streams.

Format


type 'a fmt = Format.formatter -> 'a -> unit 
'a fmt is the signature for pretty printers.
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). The pp is be a pretty printer for list elements.

File system types


type file_type = 
| File
| Directory
The sum type of possible file types we expect
type path = string list 
A path is a list of strings
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_to_path str is String.cuts "/"
    str
.
type item = file_type * string 
An item is a type and its payload