Skip to content

avoid bad duplicate module checks #7615

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

Closed
wants to merge 1 commit into from
Closed

Conversation

gbaz
Copy link
Collaborator

@gbaz gbaz commented Sep 3, 2021

Resolves #4629

This tries to be relatively minimal, by introducing a special flattening call which attempts to merge conditionals without introducing spurious duplication.

@gbaz
Copy link
Collaborator Author

gbaz commented Sep 3, 2021

I still need to test this a bit before merge, and possibly we want to introduce an explicit regression test for it as well...

ab = a <> b

-- if something exists in both branches of a conditional, only add it once
o x y = x ++ filter (not . (`elem` x)) y
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The intent isn't exactly like ordNub -- it preserves duplication as long as that duplication exists already in either of the branches. So if x or y contains duplicates, then x o y should also contain them. (And as I write this, I see where it actually fails to have that semantics fully, but that's the intention, at least !).

@gbaz
Copy link
Collaborator Author

gbaz commented Sep 3, 2021

Actually this approach isn't the cleanest -- the conditional logic is trickier to capture than I think this newtype approach allows. Will close and try a different angle.

@gbaz gbaz closed this Sep 3, 2021
@gbaz gbaz deleted the gb/fix-flat-dup-module-check branch September 3, 2021 21:09
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.

cabal check doesn't account for conditionals
2 participants