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

Properly implement round-trip property for if/else #6193

Open
sgraf812 opened this issue Aug 16, 2019 · 1 comment
Open

Properly implement round-trip property for if/else #6193

sgraf812 opened this issue Aug 16, 2019 · 1 comment

Comments

@sgraf812
Copy link
Contributor

In #6188, @phadej is hesitating to delete dead code because

That dead code reminds me of an unsolved issue, but when it's gone there won't be anything reminding of that ugliness...

So I'm recording his process in #6188 (comment) here so that this issue can serve as a memory hook for him to come back and fix the code later


The code there is in the state to have roundtrip property for code like

if flag(some-condition)
  buildable: True
else
  buildable: False

which is ugly when pretty-printed as:

if flag(some-condition)
else
  buildable: False

That's because buildable: True is no-op, and there could be other a like.

One way, is to pretty-print that as

if !flag(some-condition)
  buildable: False

But that violates roundtrip property.

sgraf812 added a commit to sgraf812/cabal that referenced this issue Aug 19, 2019
This would trip up the improved pattern match checker from [!963](https://gitlab.haskell.org/ghc/ghc/merge_requests/963).

The removed code is related to maintaining the round-trip property, so
should be re-introduced at some point. This is tracked in haskell#6193.
@phadej
Copy link
Collaborator

phadej commented Aug 30, 2019

Slight duplicate of #6189

sgraf812 added a commit to sgraf812/cabal that referenced this issue Sep 8, 2019
This would trip up the improved pattern match checker from [!963](https://gitlab.haskell.org/ghc/ghc/merge_requests/963).

The removed code is related to maintaining the round-trip property, so
should be re-introduced at some point. This is tracked in haskell#6193.
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

3 participants