cdepillabout/pretty-simple

[rfe] add pPrintCompact

juhp opened this issue ยท 3 comments

juhp commented

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})

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 commented

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 :-)

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.