You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WIP] Fix#4251: Simplify verbose "rejecting" message in solver
This commit makes the following changes:
- Enhancements to the codebase:
* Adds several TODO/FIXME/HELP comments, laying the groundwork for
improved solver output as described in RFC 4251 ;
* Refactors the `showMessages` function to split the logic of
building the output (now as a `Message'` enumeration) and the
string representation of it (now formatted by `displayMessage'`).
- Modifications to the solver output:
* If the `-v3` or `--minimize-conflict-set` flags are not set, it
now prompts the user to consider using them in cases of the
"Could not resolve dependencies: ..." error ;
* The message "(has the same characteristics that caused the
previous version to fail: ...)" has been rephrased to
"all other available packages. They are excluded due to the same
constraint that caused the last version attempted to fail: ..." ;
* Package lists are now grouped by name. For example, instead of
displaying `aeson-1.0.2.1, aeson-1.0.2.0, aeson-1.0.1.0, ...`, it
now shows `aeson: 1.0.2.1, 1.0.2.0, 1.0.1.0, ...`.
displayMessage' (PackageGoal qpn gr) ="next goal: "++ showQPN qpn ++ showGR gr
87
+
displayMessage' (RejectF qfn b c fr) ="rejecting: "++ showQFNBool qfn b ++ showFR c fr
88
+
displayMessage' (RejectS qsn b c fr) ="rejecting: "++ showQSNBool qsn b ++ showFR c fr
89
+
displayMessage' (Skipping' cs) = showConflicts cs
90
+
displayMessage' (TryingF qfn b) ="trying: "++ showQFNBool qfn b
91
+
displayMessage' (TryingP qpn i mgr) ="trying: "++ showQPNPOpt qpn i ++maybe"" showGR mgr
92
+
displayMessage' (TryingS qsn b) ="trying: "++ showQSNBool qsn b
93
+
displayMessage' (UnknownPackage' qpn gr) ="unknown package: "++ showQPN qpn ++ showGR gr
94
+
displayMessage' Success'="done"
95
+
displayMessage' (Failure' c fr) ="fail"++ showFR c fr
96
+
97
+
-- E.g. instead of displaying `aeson-1.0.2.1, aeson-1.0.2.0, aeson-1.0.1.0, ...`,
98
+
-- aim to display `aeson: 1.0.2.1, 1.0.2.0, 1.0.1.0, ...`.
99
+
displayMessage' (SkipMany _ _ cs) ="skipping: "++ showConflicts cs -- Here, I'm not sure to see the point of displaying the list of packages since the constraint is already displayed (TODO: display it only in -v3 ...)
100
+
displayMessage' (RejectMany qpn is c fr) ="rejecting: "++ fmtPkgsGroupedByName (map (showQPNPOpt qpn) (reverse is)) ++ showFR c fr
101
+
-- HELP: How to pass the verbosity level to this function?
102
+
103
+
-- Optionnal: I have yet no clue of how to display the solver output as a "tree",
104
+
-- as suggested in the proposal https://github.com/haskell/cabal/issues/8939
105
+
44
106
--| Transforms the structured message type to actual messages (strings).
45
107
--
46
108
-- The log contains level numbers, which are useful for any trace that involves
@@ -54,38 +116,42 @@ showMessages = go 0
54
116
go::Int->ProgressMessageab->ProgressStringab
55
117
go !_ (Done x) =Done x
56
118
go !_ (Fail x) =Fail x
119
+
-- TODO: I should use the the level of recursion to change the displayMessage' indentation level ...
120
+
57
121
-- complex patterns
58
122
go !l (Step (TryP qpn i) (StepEnter (Step (Failure c fr) (StepLeave ms)))) =
showFR _ (NewPackageIsMissingRequiredComponent comp dr) =" (does not contain "++ showExposedComponent comp ++", which is required by "++ showDependencyReason dr ++")"
226
290
showFR _ (NewPackageHasPrivateRequiredComponent comp dr) =" ("++ showExposedComponent comp ++" is private, but it is required by "++ showDependencyReason dr ++")"
0 commit comments