Open srlopez opened 5 years ago
The problem is that "print depth" limitations are kicking in very hard, even for structured formatting attributes. Setting say
fsi.PrintDepth <- 10000
fixes this. The default is 100, but recursive calls via %A
are hit by a 10x penalty
This is not mentioned at https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/plaintext-formatting#large-cyclic-or-deeply-nested-values
I do think this should be fixed/tuned better. Relevant lines are
@dsyme is there a way to do fsi.PrintDepth <- 10000
in regular project .fs files or is this only available for .fsx script files?
In my project the value fsi
seems to be undefined
In my project the value fsi seems to be undefined
@Arrow7000 fsi
value is defined in FSharp.Compiler.Interactive.Settings
assembly that is automatically referenced in scripts. It's a part of F# Interactive.
Right, does that mean there's no way to set the print depth on regular F# files, run as part of an assembly and not in an interactive session?
Not that I am aware of, no. You might want to try setting <PrintDepth>
in a project file and see?
Doesn't seem to do anything unfortunately
Is there no way to override the default format options print depth in the compiler? Or is the compiler version of the formatter already 'baked in' and so can't be modified?
Alternatively... if I import the F# compiler service Nuget package into my own project could I use that to create my own custom formatter function that's exactly the same as the built in printf "%A"
one, but with the PrintDepth
option modified?
Context: Running F# in a containerized environment with
dotnet 2.2.203
F# Version: $ fsharpc Microsoft (R) F# Compiler version 10.2.3 for F# 4.5Question: The
StructuredFormatDisplay
in a Composed Record doesn't work.Repro steps
These is the code
Expected behavior
The expected behavior just print the Diks size correctly on both lines %O and %A
Actual behavior
On the %A line apears some dots (...) insted of the real value
Known workarounds
One workaround could be adding a new string property holding the formatted string of the disk list, and use that property instead: (stackoverflow)
Related information
Running F# in a containerized environment with
dotnet 2.2.203
F# Version: $ fsharpc Microsoft (R) F# Compiler version 10.2.3 for F# 4.5Extra issue
Additionally, in a record, if an
option field
without value, i.e. withNone
value, does not use the StructuredFormatDisplay attribute, it instead prints the contents of the record without showing error. and the option field shows it as None.Couldn't you use the attribute and print None too? Example code: take care of the mutable field Boss, is a string option.
Result:
The desired behavior would be:
Thanks.