Skip to content
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

Pretty printer + improved plan construction errors #2236

Merged
merged 3 commits into from
Aug 6, 2016

Conversation

mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Jun 4, 2016

Sometimes when you select the wrong version of a package that a lot of things depend on, you can get gobs and gobs of output. For example, setting containers-0.3.0.0 breaks pretty much every package in the build plan and you get hundreds of lines of output: https://gist.github.com/mgsloan/2a93bc5282f38d9b337e9571dbc8611a

I've omitted info about which specific inter-package dependencies have failed. Instead, it tells you the root problem with color-coded info

2016-06-03-211018_472x97_scrot

The "needed due to" path gives the shortest path from a target to the package. Hopefully it's clear that this is not necessarily the only path (in this case, just one of many)

Just (_, parents) -> map (\(pkgId, _) -> (packageIdentifierName pkgId, extendDepsPath pkgId dp)) parents

data DepsPath = DepsPath Int Int [PackageIdentifier]
deriving (Eq, Ord, Show)
Copy link
Member

Choose a reason for hiding this comment

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

I think this type could be improved with record syntax and/or a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Done

@sjakobi
Copy link
Member

sjakobi commented Jun 4, 2016

Awesome stuff! This will fix #1739 too!

@@ -731,7 +749,8 @@ pprintExceptions exceptions stackYaml =
vsep (map pprintExtra (Map.toList extras)) <>
line <>
line <>
"You may also want to try the 'stack solver' command" <> line <> line
"You may also want to try the 'stack solver' command" <> line <> line <>
fromString (show parentMap)
Copy link
Member

Choose a reason for hiding this comment

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

The debug output here should be removed eventually.

@sjakobi
Copy link
Member

sjakobi commented Jun 4, 2016

Also, the line wrapping could be a bit cleaner IMO. Currently, readability at both 80 and 100 columns isn't that great. (Much better than before anyway, of course! :D)

80 columns:
pprint_80cols

100 columns:
pprint_100cols

I'd prefer the output to be optimized for 80 columns but clean output at 100 columns would make me happy, too! ;)

@mgsloan mgsloan merged commit 94bd76b into master Aug 6, 2016
mgsloan added a commit that referenced this pull request Aug 6, 2016
Pretty printer + improved plan construction errors
@mgsloan mgsloan deleted the 1912-pretty-printer branch August 6, 2016 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants