How to silence the output produced by other tools?
Jasmin Blanchette wrote: When writing Nitpick, I found the need to silence
the other tools upon which Nitpick relies, because their output interfered
in bad ways with Nitpick's own output. So I used code like the following:
(* (string -> unit) ref -> ('a -> 'b) -> 'a -> 'b *)
fun silence_one out_fn f x =
let
val old_out_fn = !out_fn
val _ = out_fn := K ()
val y = f x
val _ = out_fn := old_out_fn
in y end
(* ('a -> 'b) -> 'a -> 'b *)
fun silence f =
fold silence_one
[Output.writeln_fn, Output.priority_fn, Output.tracing_fn,
Output.warning_fn, Output.error_fn, Output.debug_fn,
Output.prompt_fn, Output.status_fn] f
Last modified: Thu May 21 21:43:15 CEST 2009
[Validate this page.]