Module Common


module Common: sig .. end
Basic types and definitions required throughout the system.

exception Bug of string
exception Finally of exn * exn
Raised when finalization after an exception failed, too. The first exception argument is the one raised by the initial function, the second exception the one raised by the finalizer.
exception Validation_error of string list
exception Unimplemented of string
type decimal = float 
val sexp_of_decimal : decimal -> Sexplib.Sexp.t
val decimal_of_sexp : Sexplib.Sexp.t -> decimal
val bin_size_decimal : decimal Bin_prot.Size.sizer
val bin_write_decimal : decimal Bin_prot.Write_ml.writer
val bin_write_decimal_ : decimal Bin_prot.Unsafe_write_c.writer
val bin_writer_decimal : decimal Bin_prot.Type_class.writer
val bin_read_decimal : decimal Bin_prot.Read_ml.reader
val bin_read_decimal_ : decimal Bin_prot.Unsafe_read_c.reader
val bin_read_decimal__ : (int -> decimal) Bin_prot.Unsafe_read_c.reader
val bin_reader_decimal : decimal Bin_prot.Type_class.reader
val bin_decimal : decimal Bin_prot.Type_class.t
type ('a, 'b) result = ('a, 'b) Result.t = 
| Ok of 'a
| Error of 'b

type 'a bound =
| Incl of 'a
| Excl of 'a
| Unbounded

type passfail =
| Pass
| Fail of string
type immutable 
handy types for marking things read-only and read-write
val bin_size_immutable : immutable Bin_prot.Size.sizer
val bin_write_immutable : immutable Bin_prot.Write_ml.writer
val bin_write_immutable_ : immutable Bin_prot.Unsafe_write_c.writer
val bin_writer_immutable : immutable Bin_prot.Type_class.writer
val bin_read_immutable : immutable Bin_prot.Read_ml.reader
val bin_read_immutable_ : immutable Bin_prot.Unsafe_read_c.reader
val bin_read_immutable__ : (int -> immutable) Bin_prot.Unsafe_read_c.reader
val bin_reader_immutable : immutable Bin_prot.Type_class.reader
val bin_immutable : immutable Bin_prot.Type_class.t
val sexp_of_immutable : immutable -> Sexplib.Sexp.t
val immutable_of_sexp : Sexplib.Sexp.t -> immutable
type read_only 
handy types for marking things read-only and read-write
val bin_size_read_only : read_only Bin_prot.Size.sizer
val bin_write_read_only : read_only Bin_prot.Write_ml.writer
val bin_write_read_only_ : read_only Bin_prot.Unsafe_write_c.writer
val bin_writer_read_only : read_only Bin_prot.Type_class.writer
val bin_read_read_only : read_only Bin_prot.Read_ml.reader
val bin_read_read_only_ : read_only Bin_prot.Unsafe_read_c.reader
val bin_read_read_only__ : (int -> read_only) Bin_prot.Unsafe_read_c.reader
val bin_reader_read_only : read_only Bin_prot.Type_class.reader
val bin_read_only : read_only Bin_prot.Type_class.t
val sexp_of_read_only : read_only -> Sexplib.Sexp.t
val read_only_of_sexp : Sexplib.Sexp.t -> read_only
type read_write 
handy types for marking things read-only and read-write
val bin_size_read_write : read_write Bin_prot.Size.sizer
val bin_write_read_write : read_write Bin_prot.Write_ml.writer
val bin_write_read_write_ : read_write Bin_prot.Unsafe_write_c.writer
val bin_writer_read_write : read_write Bin_prot.Type_class.writer
val bin_read_read_write : read_write Bin_prot.Read_ml.reader
val bin_read_read_write_ : read_write Bin_prot.Unsafe_read_c.reader
val bin_read_read_write__ : (int -> read_write) Bin_prot.Unsafe_read_c.reader
val bin_reader_read_write : read_write Bin_prot.Type_class.reader
val bin_read_write : read_write Bin_prot.Type_class.t
val sexp_of_read_write : read_write -> Sexplib.Sexp.t
val read_write_of_sexp : Sexplib.Sexp.t -> read_write
type write_only 
handy types for marking things read-only and read-write
val bin_size_write_only : write_only Bin_prot.Size.sizer
val bin_write_write_only : write_only Bin_prot.Write_ml.writer
val bin_write_write_only_ : write_only Bin_prot.Unsafe_write_c.writer
val bin_writer_write_only : write_only Bin_prot.Type_class.writer
val bin_read_write_only : write_only Bin_prot.Read_ml.reader
val bin_read_write_only_ : write_only Bin_prot.Unsafe_read_c.reader
val bin_read_write_only__ : (int -> write_only) Bin_prot.Unsafe_read_c.reader
val bin_reader_write_only : write_only Bin_prot.Type_class.reader
val bin_write_only : write_only Bin_prot.Type_class.t
val sexp_of_write_only : write_only -> Sexplib.Sexp.t
val write_only_of_sexp : Sexplib.Sexp.t -> write_only
type never_returns 
never_returns should be used as the return type of functions that don't return and might block forever, rather than 'a or _. This forces callers of such functions to have a call to never_returns at the call site, which makes it clear to readers what's going on. We do not intend to use this type for functions such as failwithf that always raise an exception.
val never_returns : never_returns -> 'a

Error handling

val protectx : f:('a -> 'b) -> 'a -> finally:('a -> unit) -> 'b
See exn.mli
val protect : f:(unit -> 'a) -> finally:(unit -> unit) -> 'a
val critical_section : Mutex.t -> f:(unit -> 'a) -> 'a

Input Output

val read_wrap : ?binary:bool -> f:(Pervasives.in_channel -> 'a) -> string -> 'a
read_wrap ~f fname executes ~f on the open input channel from fname, and closes it afterwards. Opens channel in binary mode iff binary is true.
val write_wrap : ?binary:bool -> f:(Pervasives.out_channel -> 'a) -> string -> 'a
write_wrap ~f fname executes ~f on the open output channel from fname, and closes it afterwards. Opens channel in binary mode iff binary is true.
val write_lines : string -> string list -> unit
write_lines fname lines writes each string in lines (plus a newlnie) to file fname.
val input_lines : ?fix_win_eol:bool -> Pervasives.in_channel -> string list
Completely reads an input channel and returns the results as a list of strings. Each line in one string.
val read_lines : string -> string list
read_lines filename Opens filename, reads all lines, and closes the file.
val fst3 : 'a * 'b * 'c -> 'a
triple handling

val snd3 : 'a * 'b * 'c -> 'b
Returns the second element of a triple.
val trd3 : 'a * 'b * 'c -> 'c
Returns the third element of a triple.
val ss_fst : ('a, 'b) Space_safe_tuple.T2.t -> 'a
space safe double and triple handling

val ss_snd : ('a, 'b) Space_safe_tuple.T2.t -> 'b
val ss_fst3 : ('a, 'b, 'c) Space_safe_tuple.T3.t -> 'a
val ss_snd3 : ('a, 'b, 'c) Space_safe_tuple.T3.t -> 'b
val ss_trd3 : ('a, 'b, 'c) Space_safe_tuple.T3.t -> 'c
val may : ('a -> unit) -> 'a option -> unit
Option handling

val uw : 'a option -> 'a
unwraps an option, throwing Not_found if it is None
val (|!) : 'a -> ('a -> 'b) -> 'b
Functions from function.ml

val ident : 'a -> 'a
val const : 'a -> 'b -> 'a
val ascending : 'a -> 'a -> int
A comparator that returns results in ascending order.

A comparator that returns results in descending order.

val descending : 'a -> 'a -> int
A comparator that returns results in descending order.
val (^/) : string -> string -> string
same as Filename.concat
val failwithf : ('a, unit, string, unit -> 'b) Pervasives.format4 -> 'a
val invalid_argf : ('a, unit, string, unit -> 'b) Pervasives.format4 -> 'a
val exitf : ('a, unit, string, unit -> 'b) Pervasives.format4 -> 'a
val equal : 'a -> 'a -> bool
toplevel binding for polymorphic equality (=). Named for easy use in labelled arguments (one can do f x y ~equal).
val phys_equal : 'a -> 'a -> bool
val (==) : 'a -> 'a -> [ `Consider_using_phys_equal ]
val (!=) : 'a -> 'a -> [ `Consider_using_phys_equal ]
val kprintf : 'a -> [ `Please_use_ksprintf ]
val seek_out : Pervasives.out_channel -> int64 -> unit
val pos_out : Pervasives.out_channel -> int64
val out_channel_length : Pervasives.out_channel -> int64
val seek_in : Pervasives.in_channel -> int64 -> unit
val pos_in : Pervasives.in_channel -> int64
val in_channel_length : Pervasives.in_channel -> int64