cdepillabout / pretty-simple

pretty-printer for Haskell data types that have a Show instance
https://hackage.haskell.org/package/pretty-simple
BSD 3-Clause "New" or "Revised" License
243 stars 29 forks source link

[rfe] add pPrintCompact #98

Open juhp opened 3 years ago

juhp commented 3 years ago

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 commented 3 years ago

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:

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:

juhp commented 3 years ago

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 :+1: I dunno why it isn't default already :-)

georgefst commented 3 years ago

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.