Module Utils

module Utils: sig .. end

Utils



type 'a sequence = ('a -> unit) -> unit 
type 'a or_error = ('a, string) CCResult.t 

Time


module Time: sig .. end

Debugging


module Section: sig .. end
Debug section
val set_debug : int -> unit
Set debug level of Section.root
val get_debug : unit -> int
Current debug level for Section.root
val debugf : ?lock:bool ->
?section:Section.t ->
int ->
('a, Format.formatter, unit, unit) Pervasives.format4 -> ('a -> unit) -> unit
Print a debug message, with the given section and verbosity level. The message might be dropped if its level is too high.
val debug : ?lock:bool -> ?section:Section.t -> int -> string -> unit

Callbacks


module Callback: sig .. end

Vector


val vec_fold_map : ('b -> 'a -> 'b * 'c) ->
'b -> ('a, 'd) CCVector.t -> 'b * ('c, [ `RW ]) CCVector.t

Lists


val fold_map : ('b -> 'a -> 'b * 'c) -> 'b -> 'a list -> 'b * 'c list
val fold_mapi : f:(int -> 'b -> 'a -> 'b * 'c) -> x:'b -> 'a list -> 'b * 'c list
val filteri : (int -> 'a -> bool) -> 'a list -> 'a list
val singleton_if : bool -> f:('a -> 'b) -> 'a -> 'b list

Arg

Small overlay on top of Arg
val arg_choice : (string * 'a) list -> ('a -> unit) -> Arg.spec
arg_choice ~kind l f picks a CLI option among the string in l, and apply f to the result.

Warnings


type warning = 
| Warn_overlapping_match
| Warn_model_parsing_error
val toggle_warning : warning -> bool -> unit
Enable/disable the given warning
val is_warning_enabled : warning -> bool
Is this warning enabled?
val warning : warning -> string -> unit
Emit the given warning with the associated message
val warningf : warning -> ('a, Format.formatter, unit, unit) Pervasives.format4 -> 'a
val options_warnings_ : (Arg.key * Arg.spec * Arg.doc) list
val options_others_ : (Arg.key * Arg.spec * Arg.doc) list Pervasives.ref
val add_option : Arg.key * Arg.spec * Arg.doc -> unit
Add an option to Utils.options_others_

Misc


exception NotImplemented of string
val pp_seq : ?sep:string -> 'a CCFormat.printer -> 'a Sequence.t CCFormat.printer
val pp_list : ?sep:string -> 'a CCFormat.printer -> 'a list CCFormat.printer
val pp_error_prefix : unit CCFormat.printer
val err_sprintf : ('a, Format.formatter, unit, string) Pervasives.format4 -> 'a
val not_implemented : string -> 'a
Raise an exception saying the given feature is not implemented
val not_implementedf : ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
Format-based version of Utils.not_implemented
val failwithf : ('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
Format version of failwith
val err_of_exn : exn -> 'a or_error
Make an error out of an exception, with the stack trace
val exn_ksprintf : f:(string -> exn) ->
('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
A sprintf implementation for formatters, that calls an exception raising function f
val ignore_catch : ('a -> 'b) -> 'a -> unit
ignore_catch f x computes f x, ignores the result, and also ignores any exception raised by f x.