Up

module Debug

: sig

Utilities for printing debug messages.

#
val eprint : string -> unit

eprint message prints to stderr message, followed by a newline and flush. This is the same as prerr_endline.

#
val eprints : string -> 'a -> ('a -> Sexplib.Sexp.t) -> unit

eprints message a sexp_of_a prints to stderr message and a as a sexp, followed by a newline and flush.

#
val eprintf : ('r, unit, string, unit) Pervasives.format4 -> 'r

eprintf message arg1 ... argn prints to stderr message, with sprintf-style format characters instantiated, followed by a newline and flush.

#
module Make : functor (M : sig
end
) -> sig

Debug.Make produces a debug function used to wrap a function to display arguments before calling and display results after returning. Intended usage is:

      module Foo = struct
        type t = ...
        let invariant = ...
        let bar t x y : Result.t = ...
      end
      module Foo_debug = struct
        open Foo
        include Debug.Make ()
        let debug x = debug invariant ~module_name:"Foo" x
        let bar t x y =
          debug "bar" [t] (t, x, y) <:sexp_of< t * X.t * Y.t >> <:sexp_of< Result.t >>
            (fun () -> bar t x y)
      end
#
val check_invariant : bool Pervasives.ref
#
val show_messages : bool Pervasives.ref
#
val debug : 't Invariant.t -> module_name:string -> string -> 't list -> 'args -> ('args -> Sexplib.Sexp.t) -> ('result -> Sexplib.Sexp.t) -> (unit -> 'result) -> 'result
end
end