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] add pPrintCompact #98

Open
juhp opened this issue Jul 18, 2021 · 3 comments
Open

[rfe] add pPrintCompact #98

juhp opened this issue Jul 18, 2021 · 3 comments

Comments

@juhp
Copy link
Contributor

juhp commented Jul 18, 2021

As originally mentioned in #93 it would be convenient if Text.Pretty.Simple provided:

pPrintCompact = 
  pPrintOpt CheckColorTty (defaultOutputOptionsDarkBg {outputOptionsCompact = True, 
                                                       outputOptionsCompactParens = True})

and I suppose correspondingly:

pPrintCompactLightBg = 
  pPrintOpt CheckColorTty (defaultOutputOptionsLightBg {outputOptionsCompact = True, 
                                                        outputOptionsCompactParens = True})
@cdepillabout
Copy link
Owner

I'm not necessarily against this, but one problem with adding functions with different features to Text.Pretty.Simple is that we end up with a combinatorial explosion of functions.

Currently, Text.Pretty.Simple has functions with these different features:

  • taking different types of inputs (pPrint that takes anything Showable, pPrintString that takes a String that has already been shown, etc)
  • using different types of outputs: taking a handle, force printing to stdout, or printing to Text (pPrint vs pHPrint vs pShow)
  • whether or not to print to a dark background, light backgrount, or not use color (pPrint / pPrintDarkBg vs. pPrintLightBg vs. pPrintNoColor)
  • whether or not to take options for changing how the output looks (pPrint vs. pPrintOpt)

Even for this existing functionality, I don't think we have all proper combinations of each of these features.

If we added another feature to this matrix (whether or not to print compact), it would cause a bunch of additional functions that need to be added to Text.Pretty.Simple if we want to properly provide all combinations of features.

Like I said above, I'm not necessarily against providing a compact version of all these functions, but there are a couple things to think about:

  • Would enough users benefit from this? I'd like at least a few more people to reply to this issue and say "I absolutely can't live without this" before adding something like this.

  • Would it be possible to just change the default output format to compact? Is there anyone that absolutely hates compact?

  • Would we be able to compromise and add pPrintCompact, but not add any other combinations? Would this annoy users? (In practice, which features/functions from Text.Pretty.Simple are the most used?)

  • We haven't done it up until now, but we would also create additional modules to help with this complexity. We could have modules like Text.Pretty.Simple.Dark.NonCompact, Text.Pretty.Simple.Light.Compact, etc.

@juhp
Copy link
Contributor Author

juhp commented Jul 24, 2021

Would it be possible to just change the default output format to compact? Is there anyone that absolutely hates compact?

This would be my personal vote 👍 I dunno why it isn't default already :-)

@georgefst
Copy link
Collaborator

Would it be possible to just change the default output format to compact? Is there anyone that absolutely hates compact?

I wouldn't be comfortable with that. It's a fairly recently-added feature, which isn't that well-tested, and has weird behaviour in some cases right now: #84.

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

3 participants