-
Notifications
You must be signed in to change notification settings - Fork 722
Fix two issues when starting the repl #11237
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
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks a lot!
I imagine people may get a little upset about not being able to avoid specifying a target in the project context. But it's a reasonable approach, I agree. I suppose, an alternative would be to default to the first package in the list of packages
in the project file (and then there is some defaulting algorithm to pick a target in that package, I assume)? In that case (unlike with defaulting to the alphabetically first), you can reorder packages in that list and put the more important one first for convenience of being able to say just cabal repl
.
Another thought: is multi-repl not up to solve this explicit-target requirement because it still has to default to some target to pick the "active" target? (And also multi-repl isn't universally available across GHC versions.)
I don't want to go deep down the rabbit hole of picking The Best™ default, just wanted to make sure we considered alternatives.
Is this a sufficiently breaking change that we want this in 3.18, not in 3.16? If so, let's set the don't-backport label so that we don't forget. Edit; I mean, user-workflow breaking, mostly, not API-breaking. |
I don't think it is breaking any existing workflows. Which ones do you have in mind? |
If anything, it's the bug this fixes that is breaking workflows. |
@Mikolaj let's review the facts:
Overall, I think it should be included in 3.16.1.0. |
You can see the behaviour now in the With 3.14 in the
In 3.16 we get
With this patch we get:
For the 3.14
With 3.16
With this patch:
|
To summarise:
What has been omitted from @philderbeast's work is he always changed the default in the case that there was just one "package". I omitted that as it changed the behaviour, but we can easily modify that as well with this patch (modify the part which throws the new error to instead return a specific selector). |
I didn't want to get into this kind of thing for a bug-fix but my changes make it easier to experiment with these questions in future. I think @philderbeast was interested as well in this question. |
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.
Thanks for addressing my comments!
Issue 1: In 3.14 there was a poor error when starting a repl in a project context without any targets. In 3.16, this error regressed, so cabal just exited cleanly. Issue 2: The repl was broken when started from a global context. Issue 1 is fixed by checking to see if there are any user targets, and issuing a proper error if there are none. Issue 2 is fixed by specifying the correct fake target which is constructed when starting the repl in the global context. Both are reported in #11107 and fixed in this patch. Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
Issue 1: In 3.14 there was a poor error when starting a repl in a project context without any targets. In 3.16, this error regressed, so cabal just exited cleanly.
Issue 2: The repl was broken when started from a global context.
Issue 1 is fixed by checking to see if there are any user targets, and issuing a proper error if there are none.
Issue 2 is fixed by specifying the correct fake target which is constructed when starting the repl in the global context.
Both are reported in #11107 and fixed in this patch.
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significant
in the changelog file.