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

Fewer spaces #105

Merged
merged 3 commits into from
Mar 30, 2022
Merged

Fewer spaces #105

merged 3 commits into from
Mar 30, 2022

Conversation

georgefst
Copy link
Collaborator

@georgefst georgefst commented Mar 27, 2022

Closes #75.

to do

  • clean up
  • add regression tests with inputs from Too many spaces #75
  • for posterity, explain why this fixes everything

@georgefst georgefst marked this pull request as draft March 27, 2022 23:22
Rather than stripping all whitespace after parsing, then adding it back between every expression, we now mostly keep whatever whitespace existed in the input.

This partially reverts 20d8a2d. With the other changes in that commit, we had assumed that this sledgehammer approach to whitespace was virtually necessary. This commit shows that, with a bit more care, that needn't be the case. We add some tests for inputs on which we had regressed to unpleasantly whitespace-heavy output.
With the whitespace handling changes in the previous commit, it became far simpler, and ultimately unnecessary. We inline the one non-trivial part in to `prettyExpr`.
src/Text/Pretty/Simple.hs Outdated Show resolved Hide resolved
@georgefst georgefst marked this pull request as ready for review March 28, 2022 18:28
@georgefst georgefst mentioned this pull request Mar 28, 2022
Copy link
Owner

@cdepillabout cdepillabout left a comment

Choose a reason for hiding this comment

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

Great, thanks for working on this!

This looks good to me.

You want to add a CHANGELOG and make a release?

Comment on lines +691 to +712
-- __Weird/illegal show instances__
--
-- >>> pPrintString "2019-02-18 20:56:24.265489 UTC"
-- 2019-02-18 20:56:24.265489 UTC
--
-- >>> pPrintString "a7ed86f7-7f2c-4be5-a760-46a3950c2abf"
-- a7ed86f7-7f2c-4be5-a760-46a3950c2abf
--
-- >>> pPrintString "192.168.0.1:8000"
-- 192.168.0.1:8000
--
-- >>> pPrintString "A @\"type\" 1"
-- A @"type" 1
--
-- >>> pPrintString "2+2"
-- 2+2
--
-- >>> pPrintString "1.0e-2"
-- 1.0e-2
--
-- >>> pPrintString "0x1b"
-- 0x1b
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for the examples!

@georgefst
Copy link
Collaborator Author

You want to add a CHANGELOG and make a release?

I'm inclined to wait a few days, to see if anyone has any concerns (#75 (comment)). If there's no response, I'll release on the weekend.

@cdepillabout
Copy link
Owner

That sounds good to me!

@georgefst
Copy link
Collaborator Author

Actually, I'll do it now. I don't know if I'll have time on the weekend.

@georgefst georgefst merged commit 9196dee into cdepillabout:master Mar 30, 2022
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.

Too many spaces
2 participants