-
Notifications
You must be signed in to change notification settings - Fork 698
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
Fix #4986, and extra refactoring #4991
Conversation
I have uneasy feeling about re-using |
@phadej Show is not all that appropriate either, because conventionally the Show instance of a datatype is intended to be valid Haskell, and I don't necessarily want to force Pretty-printed variants of types to be valid Haskell; a very simple case where this would be extremely annoying are newtypes of Text, where barfing out the constructor name would be a big problem for readability. So I'm 👎 on PShow, but 👍 for Outputable. I guess I'll add that class... |
Given `IsString`, PShow could be a little "reality twister". My doubt is more about inconsistencies, how `Maybe InstalledPackageInfo` or `[PackageDescription]` would be debug output? Cabal-like syntax is compact, but it doesn't *compose* well. So I'm 👍 for Haskell-like record syntax for those.
I'd recommend splitting this PR into bug fix, which can go in (with old style asserts) and then we can bikeshed on Outputtable/PShow/Pretty without hurry (that's not critical to get into 2.2, is it?)
…Sent from my iPhone
On 2 Jan 2018, at 3.11, Edward Z. Yang ***@***.***> wrote:
@phadej Show is not all that appropriate either, because conventionally the Show instance of a datatype is intended to be valid Haskell, and I don't necessarily want to force Pretty-printed variants of types to be valid Haskell; a very simple case where this would be extremely annoying are newtypes of Text, where barfing out the constructor name would be a big problem for readability. So I'm 👎 on PShow, but 👍 for Outputable. I guess I'll add that class...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
FWIW PShow can have Generic implementation, taking into account newtypes and records! A note about composability: parens! |
Seems like outputting somethink S-expression-like would be pretty trivial and sufficient for debugging? |
I force-pushed the reduced patch set, without updated asserts or pretty-printing.
I don't know what you mean by this. Are you suggesting that a PackageName can acceptably render as "pkgname", because -XOverloadedStrings can interpret this as a PackageName? But there are still situations where Haskell syntax is unacceptably verbose, and there is no way to "hack" it with OverloadedStrings. One example that came up in the patchset:
By default, I'd like ConfiguredId to render as just its ComponentId, since that canonically identifies a ConfiguredId. However, if I am debugging corrupt ConfiguredId metadata, I might also like to display the confSrcId, confCompName. In GHC, the way we do this is we render
With pretty-printing, this is not true; indentation is all you need. To take your example of
Which is basically as good as you're going to get with Haskell-style list syntax with multi-line elements. Or you be a bit more clever and have a different format:
Indentation is great! And it is much easier to parse than parentheses. P.S. Also, why do I care so much about conciseness? Because if I'm debugging I'm going to have to read all of this information, and it is far easier to understand what is going on if a single ElaboratedConfiguredPackage can fit in a few lines, rather than multiple pages. |
Signed-off-by: Edward Z. Yang <[email protected]>
Previously, if you had: build-tool-depends: happy:happy build-tools: happy This would cause an executable dependency to show up twice in exe_deps. It turns out that this made its way all the way to cabal-install's InstallPlan, and then broke an invariant in the install plan execution engine. This is the "correct" fix but the whole arrangement is a little brittle. Signed-off-by: Edward Z. Yang <[email protected]>
Signed-off-by: Edward Z. Yang <[email protected]>
…isplay. Before: In order, the following would be built (use -v for more details): - Cabal-2.1.0.0 (lib) --enable-library-profiling (first run) After: In order, the following would be built (use -v for more details): - Cabal-2.1.0.0 (lib) (first run) Signed-off-by: Edward Z. Yang <[email protected]>
Before: pkgStanzasEnabled is initialized to an empty list and filled in on the first pruning pass. After: pkgStanzasEnabled is initialized to the set of explicitly requested stanzas, and then we add more enabled stanzas as we do "pruning" passes (a bit of a misnomer). Why is it good? Now we always satisfy the invariant that the set of enabled stanzas is a superset of the set of requested stanzas; previously, the invariant was broken up until the point you ran pruning (which, in the case of new-configure, meant that the invariant was always broken!) and we were tripping over this when attempting to render the set of configure flags for plan display. Signed-off-by: Edward Z. Yang <[email protected]>
d0e6daf
to
1f00ad8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Merged, thanks! |
Cherry-picked the first four commits into 2.0. |
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
Added test for the bugfix