-
Notifications
You must be signed in to change notification settings - Fork 697
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
What should we report when there are duplicate imports? #10509
Comments
As a C programmer, I'm somewhat inclined to take the C |
We don't want anything like include guards or |
no, I think the more Haskelly way is ensuring that importing multiple times can't change the outcome regardless of its contents, and otherwise not worrying about it. If I import two project files each of which import the same other project file, it should behave just like that third file had only been imported once. (I think this is already true?) The other side of this, which is why I go toward the C route, is that every include/import is self-contained: I don't need to require the developer to "just know" that something else must be imported first for it to work. This requires idempotence as a consequence, since two "self-contained" imports may pull in the same "dependency". |
If we were to separate the reporting of duplicates (as warnings) from the "When using configuration from" message then the output could be trimmed to: $ cabal run cabal-install:exe:cabal -- build --dry-run \
--project-file=cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project
Warning: this is a debug build of cabal-install with assertions enabled.
When using configuration from:
- yops-0.project
- yops-2.config
- yops-4.config
- - yops-4.config
- yops-6.config
- - yops-6.config
- - yops-6.config
- yops-8.config
- - yops-8.config
- - yops-8.config
- - yops-8.config
- yops/yops-1.config
- yops/yops-3.config
- - yops/yops-3.config
- yops/yops-5.config
- - yops/yops-5.config
- - yops/yops-5.config
- yops/yops-7.config
- - yops/yops-7.config
- - yops/yops-7.config
- - yops/yops-7.config
- yops/yops-9.config
- - yops/yops-9.config
- - yops/yops-9.config
- - yops/yops-9.config
- - yops/yops-9.config
The following errors occurred:
- The package directory '.' does not contain any .cabal file. |
What should we report when there are duplicate imports?
Is it acceptable that there are duplicates reported for configuration, such as the 5 times for
- yops/yops-9.config
with the project added in #10508?#9933 would reject duplicate imports.
The text was updated successfully, but these errors were encountered: