-
Notifications
You must be signed in to change notification settings - Fork 710
Show constraint sources in dependency solver errors #10524
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
Open
9999years
wants to merge
5
commits into
haskell:master
Choose a base branch
from
9999years:dependency-provenance
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,419
−1,232
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
11ed225
Add `ConstraintSource` to local packages
9999years a0b9b2a
Remove `ConstraintSource`s from preferences
9999years 1be674d
Prevent rebuilds when the project file changes
9999years e6f0f78
Fix DedupUsingConfigFromComplex test
9999years b84c092
Fix HLint nits
9999years File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
cabal-install-solver/src/Distribution/Solver/Types/NamedPackage.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{-# LANGUAGE DeriveGeneric #-} | ||
|
||
module Distribution.Solver.Types.NamedPackage | ||
( NamedPackage (..) | ||
, NamedPackageConstraint | ||
) where | ||
|
||
import Distribution.Solver.Compat.Prelude | ||
import Prelude () | ||
|
||
import Distribution.Types.PackageName (PackageName) | ||
import Distribution.Solver.Types.PackageConstraint (PackageProperty) | ||
import Distribution.Solver.Types.WithConstraintSource (WithConstraintSource) | ||
import Distribution.Pretty (Pretty (pretty), commaSpaceSep) | ||
import Text.PrettyPrint | ||
|
||
-- | A package, identified by a name and properties. | ||
data NamedPackage = NamedPackage PackageName [PackageProperty] | ||
deriving (Show, Eq, Ord, Generic) | ||
|
||
instance Binary NamedPackage | ||
instance Structured NamedPackage | ||
|
||
instance Pretty NamedPackage where | ||
pretty (NamedPackage name properties) = | ||
pretty name <+> parens (commaSpaceSep properties) | ||
|
||
type NamedPackageConstraint = WithConstraintSource NamedPackage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
cabal-install-solver/src/Distribution/Solver/Types/WithConstraintSource.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE DeriveTraversable #-} | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
|
||
module Distribution.Solver.Types.WithConstraintSource | ||
( WithConstraintSource (..) | ||
, showWithConstraintSource | ||
, withUnknownConstraint | ||
) where | ||
|
||
import Distribution.Solver.Compat.Prelude | ||
|
||
import Distribution.Solver.Types.ConstraintSource (ConstraintSource (..), showConstraintSource) | ||
import Distribution.Pretty (Pretty (pretty)) | ||
import Text.PrettyPrint | ||
|
||
-- | A package bundled with a `ConstraintSource`. | ||
data WithConstraintSource pkg = | ||
9999years marked this conversation as resolved.
Show resolved
Hide resolved
|
||
WithConstraintSource | ||
{ constraintInner :: pkg | ||
-- ^ The package. | ||
, constraintSource :: ConstraintSource | ||
-- ^ The constraint source for the package. | ||
} | ||
deriving (Show, Functor, Eq, Ord, Traversable, Foldable, Generic) | ||
|
||
instance Binary pkg => Binary (WithConstraintSource pkg) | ||
instance Structured pkg => Structured (WithConstraintSource pkg) | ||
|
||
withUnknownConstraint :: pkg -> WithConstraintSource pkg | ||
withUnknownConstraint constraintInner = | ||
WithConstraintSource | ||
{ constraintInner | ||
, constraintSource = ConstraintSourceUnknown | ||
} | ||
|
||
showWithConstraintSource :: (pkg -> String) -> WithConstraintSource pkg -> String | ||
showWithConstraintSource | ||
showPackage | ||
(WithConstraintSource { constraintInner, constraintSource }) = | ||
showPackage constraintInner ++ " (" ++ showConstraintSource constraintSource ++ ")" | ||
|
||
instance Pretty pkg => Pretty (WithConstraintSource pkg) where | ||
pretty (WithConstraintSource { constraintInner, constraintSource = ConstraintSourceUnknown }) | ||
= pretty constraintInner | ||
pretty (WithConstraintSource { constraintInner, constraintSource }) | ||
= pretty constraintInner | ||
<+> parens (text "from" <+> pretty constraintSource) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.