Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rfe] option for compact (complex) lists: avoid rendering lines with only a comma #93

Closed
juhp opened this issue Jul 16, 2021 · 2 comments

Comments

@juhp
Copy link
Contributor

juhp commented Jul 16, 2021

I really like the simplicity of this library, though I do wish it defaulted to more compact output. 8-)

Simple lists render nicely:

> pPrint ["one","two"]
[ "one"
, "two"
]

But for complicated lists using available compact options:

> import Network.XmlRpc.Internals
> pPrintOpt CheckColorTty (defaultOutputOptionsDarkBg {outputOptionsCompact = True, 
                                                       outputOptionsCompactParens = True})
    [("resultCode",ValueInt 10),("resultText",ValueString "build completed in 5m 12s")]

[
    ( "resultCode", ValueInt 10 )
,
    ( "resultText", ValueString "build completed in 5m 12s" ) ]

This is a small example, but for rendering large Map's etc, having the comma on a separate line takes up a lot of vertical space. Maybe outputOptionsCompactParens should induce putting the comma on the same line?

I would love to just have a pPrintCompact function to provide such compact output (the above usage is already rather long).

further edit: perhaps the initial newline could be dropped too, to something like this?:

[   ( "resultCode", ValueInt 10 )
,   ( "resultText", ValueString "build completed in 5m 12s" ) ]
@georgefst
Copy link
Collaborator

I think this is covered by #84, except for pPrintCompact, which is possibly a good idea. Could you open that part as a separate issue? Then I'll close this and you can subscribe to #84.

@juhp
Copy link
Contributor Author

juhp commented Jul 18, 2021

Okay, thanks

@juhp juhp closed this as completed Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants