diff -r 05e5d68c9627 -r f1be8028a4a9 Nominal/activities/idp/snippets/silence.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nominal/activities/idp/snippets/silence.html Wed Mar 30 17:27:34 2016 +0100 @@ -0,0 +1,64 @@ + + + +Snippets + + + + +

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.] + +