Module Imandra_util.Util

Some simple utilities useful for Imandra

type 'a gen = unit -> 'a option
val failwithf : ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a

Formatting wrapper to failwith Example: failwithf "%s bad term %a" "ohnoes" Term.print t

val (>>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c

Function composition

val is_qualified : string -> bool

Is this a qualified identifier (ie with a non empty path)?

val chop_path : string -> string

Remove module prefix, turning A.B.c into c

val split_path : string -> string * string

Split into module prefix and identifier

val join_path : (string * string) -> string

Revere of split_path

val get_env_home : unit -> string

Obtain "$IMANDRA_HOME" environment variable

val format_time : ?⁠compact:bool -> float -> string

Formatting of time

val print_hr : unit -> unit

Print horizontal rule

val pp_hr : Stdlib.Format.formatter -> unit -> unit
val batch_banner : string
val print_banner : unit -> unit

Print banner

val print_about : unit -> unit

Print "about" message

val split_regex : by:string -> string -> string list

Split on given regex

val flat_map : ('a -> 'b list) -> 'a list -> 'b list
val zip : 'a list -> 'b list -> ('a * 'b) list

Zip of the common prefix of the lists

val unzip : ('a * 'b) list -> 'a list * 'b list
val crc_of_str : string -> int

CRC

val combine_hashes : int -> int -> int
val str_for_all : (char -> bool) -> string -> bool
val str_exists : (char -> bool) -> string -> bool
val sanitize_name : string -> string
module Lex_class : sig ... end
val remove_dups_with : (module CCHashtbl.S with type key = 'a) -> 'a list -> 'a list
val remove_dups_poly : 'a list -> 'a list
val map_c : ?⁠base:int -> ('a -> int -> 'b) -> 'a list -> 'b list

Similar to List.mapi but with an initial offset base

val iter_c : ?⁠base:int -> ('a -> int -> unit) -> 'a list -> unit

Similar to List.iteri but with an initial offset base

val list_of_hashtbl : ('a'b) Stdlib.Hashtbl.t -> ('a * 'b) list
val suggest_correction : ?⁠dist:int -> string -> ((string -> unit) -> unit) -> string option

suggest_correction ?dist s seq uses the sequence seq of available items to suggest corrections to some failing query s. It returns a string with suggestions, or None.

parameter dist

max distance acceptable for a suggestion

val q_to_float : Q.t -> float
val gen_exists : ('a -> bool) -> 'a gen -> bool
val escape_dot : string -> string

Escaping for graphviz labels

val default_style_dot : string

Default style for labels in graphviz

val on_one_line : string -> string

replace '\n' by ' ' so this fits on one line

val enable_warnings : unit -> unit
val disable_warnings : unit -> unit
val ptime_now : unit -> float

Use ptime to get a precise timestamp

module Stopwatch : sig ... end
module Str_map : CCMap.S with type Str_map.key = string
module Str_set : CCSet.S with type Str_set.elt = string
module Str_tbl : CCHashtbl.S with type Str_tbl.key = string
module Int_tbl : CCHashtbl.S with type Int_tbl.key = int
module Int_set : CCSet.S with type Int_set.elt = int
module Int_map : CCMap.S with type Int_map.key = int
val gensym : unit -> string
val print_int : Stdlib.Format.formatter -> int -> unit
val print_float : Stdlib.Format.formatter -> float -> unit
val tweak_gc : unit -> unit
val len_filtered : ('a -> bool) -> 'a list -> int
val interpret_path : string -> string
val parse_tcp_addr : string -> (Unix.inet_addr * int, string) Stdlib.result
val time : (unit -> 'a) -> 'a