Open cdepillabout opened 6 years ago
Since pretty-simple is by design for data types with a Show instance I do not consider it a bug.
The Haskell Report has the following to say about Show:
The result of show is a syntactically correct Haskell expression containing only constants, given the fixity
declarations in force at the point where the type is declared.
We can reasonably expect the input to be balanced.
@dminuoso pretty-simple
is designed for data types with a Show
instance, but it is also designed to be more flexible than other pretty-printing libraries. It should try it's hardest to pretty-print anything, even if it is not syntactically correct.
There are many commonly used data types with non-syntactically-correct Show
instances, and pretty-simple should ideally handle them. pretty-simple should also ideally not choke on non-balanced brackets, parens, etc.
Here is an example of this failing to pretty-print something with non-balanced parenthesis:
$ ghci
> import Text.Pretty.Simple
> import Data.Text.Lazy
> putStrLn $ unpack $ pString "Just \"hello\" ) 3345"
Just "hello"
You can see that everything after the )
character doesn't get printed. This should be fixed.
Pretty-simple doesn't currently allow non-balanced brackets, parens, etc.
This should be considered a bug. This is also related to #5.