Unsurprisingly, this changes the quine tests a lot. Here are the main changes:
~Floats no longer print with a trailing decimal point. I couldn't find a
format string that would print the decimal point without also printing
trailing zeros. But I actually think it's an improvement this way. The type
can be queried separately so it's redundant for it to also appear in the
printed representation. And it's actively distracting when you see the same
type printed explicitly in every element of a table. Type uniformity means
our textual representations can be more information-dense.~
Floating point printed precision is a bit different. We're using C g
format now rather than whatever Haskell uses.
Non-Fin tables no longer print with their type. Again, I think that's fine
because the type information is redundant. Same story with 0@(Fin 10).
We now just print 0.
No automatic line breaks. I didn't want to implement the layout algorithm
from Data.Text.PrettyPrint in the dex AST builder...
We now print lambda terms as just <function of type : Int -> Float> etc
instead of printing their bodies. This is what most languages do anyway.
Seeing the lambda explicitly is sometimes useful but there's always :pp
for that.
Some extra parentheses here and there. I'm not implementing precedence-aware
printing in the AST builder.
I decided to print standalone Word8 using hex. Before we printed as the
ASCII char itself if it was in the printable range, and some Haskell-defined
escape code otherwise. We still want that hack for string literals. But it
seems a bit much for standalone Word8.
unsafe_io gets DCEd in some of the io tests because it's now an argument
to show_any but it doesn't produce any non-trivial data. I tweaked the
tests but we should revisit this.
Unsurprisingly, this changes the quine tests a lot. Here are the main changes:
g
format now rather than whatever Haskell uses.0@(Fin 10)
. We now just print0
.Data.Text.PrettyPrint
in the dex AST builder...<function of type : Int -> Float>
etc instead of printing their bodies. This is what most languages do anyway. Seeing the lambda explicitly is sometimes useful but there's always:pp
for that.unsafe_io
gets DCEd in some of the io tests because it's now an argument toshow_any
but it doesn't produce any non-trivial data. I tweaked the tests but we should revisit this.