Skip to content

Add outputOptionsPrintStringLitsLiterally#68

Closed
expipiplus1 wants to merge 3 commits intocdepillabout:masterfrom
expipiplus1:joe-oopsll
Closed

Add outputOptionsPrintStringLitsLiterally#68
expipiplus1 wants to merge 3 commits intocdepillabout:masterfrom
expipiplus1:joe-oopsll

Conversation

@expipiplus1
Copy link
Copy Markdown
Contributor

Closes #64

@expipiplus1
Copy link
Copy Markdown
Contributor Author

It would be very nice to turn this on by default, but then one bumps into https://gitlab.haskell.org/ghc/ghc/issues/11529

Comment on lines +74 to +77
, outputOptionsEscapeNonPrintable :: Bool
-- ^ Whether to replace non-printable characters with hexadecimal escape
-- sequences.
, outputOptionsPrintStringLitsLiterally :: Bool
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to turn these two options into a data type with three constructors?

That might follow the flow of the code better below in the nested if statements.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, feel free to suggest some better names.

Comment on lines +672 to +676
-- >>> pPrintStringOpt CheckColorTty defaultOutputOptionsDarkBg{ outputOptionsPrintStringLitsLiterally = False } "\"Several encodings of A: A \\65 \\065 \\x41 \\n\""
-- "Several encodings of A: A A A A "
--
-- >>> pPrintStringOpt CheckColorTty defaultOutputOptionsDarkBg{ outputOptionsPrintStringLitsLiterally = True } "\"Several encodings of A: A \\65 \\065 \\x41 \\n\""
-- "Several encodings of A: A \65 \065 \x41 \n"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty neat! I bet there are definitely users that wanted something like this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@cdepillabout
Copy link
Copy Markdown
Owner

Rebased on top of master in #69.

@cdepillabout cdepillabout mentioned this pull request Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pPrint prints unexpected characters for unprintable string contents

2 participants