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

allow non-balanced brackets, parens, etc #27

Open
cdepillabout opened this issue May 13, 2018 · 4 comments
Open

allow non-balanced brackets, parens, etc #27

cdepillabout opened this issue May 13, 2018 · 4 comments

Comments

@cdepillabout
Copy link
Owner

Pretty-simple doesn't currently allow non-balanced brackets, parens, etc.

This should be considered a bug. This is also related to #5.

@dminuoso
Copy link

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.

@cdepillabout
Copy link
Owner Author

@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.

@cdepillabout
Copy link
Owner Author

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.

@cdepillabout
Copy link
Owner Author

#52 is another instance of things being dropped after non-balanced parenthesis. This should really be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants