Skip to content

Refactor before import warning#11773

Open
philderbeast wants to merge 1 commit into
haskell:masterfrom
cabalism:refactor/before-import-warning
Open

Refactor before import warning#11773
philderbeast wants to merge 1 commit into
haskell:masterfrom
cabalism:refactor/before-import-warning

Conversation

@philderbeast
Copy link
Copy Markdown
Collaborator

@philderbeast philderbeast commented Apr 30, 2026

Split from #10933, the refactoring and the sorting changes without the duplicate import by alternate paths detection, as requested by @ulysses4ever.

  • Add a new module cabal-install/src/Distribution/Client/ProjectConfig/Import.hs and move some stuff there from cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs that was only ever used in cabal-install.

For messages, I added some doctests and ended up with two ways of comparing ProjectConfigPath.

-- | A comparison that puts projects first, URLs last and sorts the other paths
-- lexically.
compareLexicographically :: ProjectConfigPath -> ProjectConfigPath -> Ordering

-- | A comparison that puts projects first, URLs last and sorts the other paths
-- by putting longer paths after shorter ones as measured by the number of path
-- segments. If still equal, then sorting is lexical.
compareSegmentally:: ProjectConfigPath -> ProjectConfigPath -> Ordering

I'll squash commits before applying the merge label if this pull request is approved.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

Copy link
Copy Markdown
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

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

Thanks a lot for splitting it --- it helped reviewing a lot! A couple nitpicks inline.

Comment thread cabal.validate.project
Comment thread cabal-install/src/Distribution/Client/ProjectConfig/Import.hs Outdated
@philderbeast philderbeast force-pushed the refactor/before-import-warning branch from 83257e1 to 0874d33 Compare May 4, 2026 17:36
@philderbeast philderbeast force-pushed the refactor/before-import-warning branch 2 times, most recently from 7310351 to 069d489 Compare May 13, 2026 15:41
@ulysses4ever
Copy link
Copy Markdown
Collaborator

One little nitpick: I can't quite parse the PR title "Refactor/before import warning". Could you turn into something more readable?

@philderbeast philderbeast changed the title Refactor/before import warning Refactor before import warning May 13, 2026
@philderbeast
Copy link
Copy Markdown
Collaborator Author

Sorry about that @ulysses4ever. That was the branch name. I've removed the needless "/" separator.

Copy link
Copy Markdown
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

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

Thank you.

- Move fetchImportConfig to Import module
- Move fetchImportParse to Import module
- Nest fetchImportConfig within fetchImportParse
- Move cyclicalImportMsg to cabal-install
- Move untrimmedUriImportMsg to cabal-install
- Move docProjectConfigFiles to cabal-install
- Add compareLexically & compareSegmentally
- Update hops test expectation for lexical sort
- Remove +legacy-comparison
- Satisfy fourmolu
- Add change log entry
- s/lexically/lexicographically/
- s/fetchImportParse/fetchImport/
@philderbeast philderbeast force-pushed the refactor/before-import-warning branch from 069d489 to de5211a Compare May 14, 2026 18:31
@philderbeast philderbeast added the merge me Tell Mergify Bot to merge label May 14, 2026
@mergify mergify Bot added the ready and waiting Mergify is waiting out the cooldown period label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge me Tell Mergify Bot to merge ready and waiting Mergify is waiting out the cooldown period type: refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants