Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fsi (FSharp interactive) quiet mode

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!

like image 243
NoIdeaHowToFixThis Avatar asked Dec 19 '22 20:12

NoIdeaHowToFixThis


2 Answers

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
like image 92
Daniel Avatar answered Jan 03 '23 11:01

Daniel


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.

like image 40
Gene Belitski Avatar answered Jan 03 '23 10:01

Gene Belitski