I wonder what you use Format
and descendants for?
I made easy-format around 2010 so I could pretty-print json and code in general, like a programmer would. Printing things like this using just Format
was incredibly tricky:
{
"field": {
"number": 123,
"text": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
This requires a box with negative indentation for the }
to be aligned with "field": {
rather than with "text":
. I don’t think it’s something the user should have to learn or understand, so it’s one of the styling options. The following style is also something that we don’t see often in popular json pretty-printers but it’s one of the built-in styles:
[
[
12345, 12345, 12345, 12345, 12345, 12345, 12345, 12345, 12345, 12345,
12345, 12345, 12345, 12345, 12345, 12345, 12345
],
[
{ "x": 0, "y": 100 },
12345,
12345,
12345,
12345,
12345,
12345,
12345,
12345,
12345,
12345,
12345,
12345
]
]
All the material within square brackets [...]
in the example above use the same built-in style. You can try this by running ydump
on arbitrary json; it’s provided by the yojson
package.
It’s great to see initiatives to offer a libraries which work better in different contexts or overall.
I’m not sure what you mean by “layers upon layers of indirection”. Would you like to elaborate? (I haven’t used Fmt
, which came later, and so I’m genuinely curious, not just sad because I’m the author of easy-format)