I am trying to use F # as REPL and scripts that use the C # library. When I evaluate an object in REPL, it prints its internal structure:
> <expression>;; val it: <type> = <subtype> {<prop> = <value>; ... <prop> = <value>;}
Then I write a script with the same expression and want it to print the same output. But I can not find the print function that would do this. The closest I could find is printfn "%O" , which uses the ToString () method, which is not defined in my case and just prints the type of the object.
This seems to be a simple question, but I cannot find it here or anywhere on Google.
How to generate a signature like F #, similar to FSI in my own code? seems to be type oriented, and I basically need some pretty printed value.
PS: it looks like this is the code that is internal to fsi.exe. See fsi.fs and sformat.fs sources. I tried to call them through reflection, but simple Internal.Utilities.StructuredFormat.any_to_string(value) printed only the type. It would be nice if someone knew how to properly call him, but for a while I decided not to spend more effort on him.
source share