Closed vcanadi closed 3 years ago
Thanks. This is another instance of #75.
I'll close this in favor of #75.
The first one is not readable by default Read instance
Being able to feed the output of pretty-simple into read
was never a goal for pretty-simple.
What are you using this for?
I guess it could be somewhat useful, but I've never really thought about it. Up until now, I don't think anyone has ever requested this.
I have some amount of static data that is used for unit testing. I've pretty printed it so it is more readable in the *Spec.hs files. Basically, I just wanted json-like line breaks of the data instead of just one single line string you have from Show.
@vcanadi There are other pretty-printing libraries in Haskell, a lot of them require a data type to have a valid Show
instance (and don't print in color by default), so it might make more sense for you to use one of them.
For instance, https://hackage.haskell.org/package/pretty-show might be a better fit for you.
A couple other links you might be interested in:
e.g
pShowOpt defaultOutputOptionsNoColor (1e-2 :: Double)
results in"1.0 e- 2"
and not"1.0e-2"
The first one is not readable by default Read instance e.g.read @Double $ unpack $ pShowOpt defaultOutputOptionsNoColor (1e-2 :: Double) *** Exception: Prelude.read: no parse