4
votes

How can I limit the output to the F# Interactive console to my own output?

In my current setup the fsi writes lots of information (on types and content of the data structures) as it runs through the script. I have tried the quiet mode without success.

Thanks!

2

2 Answers

6
votes

You can set ShowDeclarationValues, ShowProperties, and ShowIEnumerable to false.

You may still see types, but not content (which is generally the bulk of the output).

#if INTERACTIVE
fsi.ShowDeclarationValues <- false
fsi.ShowProperties <- false
fsi.ShowIEnumerable <- false
#endif
5
votes

Another unconventional method might be the following:

  • fire your FSI with --quiet option
  • instead of printf use eprintf for your own output, the effect would be exactly what you asked for

in the script

eprintfn "Testing: %n" 123

in FSI window

Testing: 123

Any other, but real error messages output simply will not appear in the FSI window, including all evaluation results; at the same time all conveniences of printf are still available to you, including familiar formatting.

UPDATE: I posted a further enhancement allowing use of unchanged output code for both normal and "quiet" modes of FSI output.