Skip to content

refactor(cabal-install, cabal-install-solver): avoid using "error" in validateSolverResult#11650

Open
andreabedini wants to merge 1 commit intohaskell:masterfrom
andreabedini:refactor/progress-monad-fail
Open

refactor(cabal-install, cabal-install-solver): avoid using "error" in validateSolverResult#11650
andreabedini wants to merge 1 commit intohaskell:masterfrom
andreabedini:refactor/progress-monad-fail

Conversation

@andreabedini
Copy link
Copy Markdown
Collaborator

  • Add a step helper and a MonadFail instance to Progress
  • Refactor validateSolverResult to integrate into the Progress monad chain
    using fail instead of error, giving structured failure instead of an
    uncatchable exception

Copilot AI review requested due to automatic review settings March 26, 2026 03:09
@andreabedini andreabedini force-pushed the refactor/progress-monad-fail branch from 60fbac8 to d153f06 Compare March 26, 2026 03:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the dependency-solver result validation path to avoid throwing uncatchable exceptions (error) by integrating validation into the Progress monad chain, enabling structured failure (Fail) instead.

Changes:

  • Add a step helper and a MonadFail instance for Progress (String failures).
  • Refactor resolveDependencies/validateSolverResult to use do-notation and fail instead of error.
  • Adjust unit tests to avoid name collisions with the new step helper.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
cabal-install/tests/UnitTests/Distribution/Solver/Modular/RetryLog.hs Renames test lambda variables to avoid clashing with newly introduced step.
cabal-install/src/Distribution/Client/Dependency.hs Converts validation from error to Progress failure and threads it through the Progress chain.
cabal-install-solver/src/Distribution/Solver/Types/Progress.hs Adds step helper and MonadFail instance to support structured failure in Progress.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andreabedini andreabedini force-pushed the refactor/progress-monad-fail branch 4 times, most recently from 8896dc1 to 4a4c61a Compare March 26, 2026 06:32
… validateSolverResult

- Add a `step` helper and a `MonadFail` instance to `Progress`
- Refactor `validateSolverResult` to integrate into the `Progress` monad chain
  using `fail` instead of `error`, giving structured failure instead of an
  uncatchable exception
@andreabedini andreabedini force-pushed the refactor/progress-monad-fail branch from 4a4c61a to 75e24eb Compare April 1, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants