Skip to content

[Fix #299] Be more specific about what hdb brings in scope.#306

Merged
Saizan merged 1 commit intomasterfrom
issue299-on-abstract
May 8, 2026
Merged

[Fix #299] Be more specific about what hdb brings in scope.#306
Saizan merged 1 commit intomasterfrom
issue299-on-abstract

Conversation

@Saizan
Copy link
Copy Markdown
Collaborator

@Saizan Saizan commented May 4, 2026

Turns out if we are careful, and cheat about package names, we can actually import home units with IIDecl.

This makes it now possible to tailor the scope to be the one inside the Module of the breakpoint we are stopped at, as wished in #299.

@Saizan Saizan self-assigned this May 4, 2026
@Saizan Saizan changed the base branch from master to abstract-hie May 4, 2026 12:56
@alt-romes
Copy link
Copy Markdown
Collaborator

And we can only run REPL evaluation when we're stopped somewhere, so there's always a consistent answer for "what's in scope":

  • The things we've imported manually
  • The things imported by the module we're stopped at

Great!

@alt-romes
Copy link
Copy Markdown
Collaborator

Should the test introduced #293 be marked as successful now?

@Saizan Saizan force-pushed the abstract-hie branch 5 times, most recently from b80f767 to bb2ef8f Compare May 5, 2026 14:58
@Saizan Saizan force-pushed the issue299-on-abstract branch from eac0326 to 913b90a Compare May 6, 2026 08:12
@Saizan Saizan changed the base branch from abstract-hie to master May 6, 2026 08:12
@Saizan Saizan force-pushed the issue299-on-abstract branch 3 times, most recently from dc554f3 to 06a686b Compare May 6, 2026 09:50
@Saizan
Copy link
Copy Markdown
Collaborator Author

Saizan commented May 6, 2026

@alt-romes I'm finding that we also need the scope of where we are stopped for getStackTrace otherwise T159 and displays stack annotation frames (issue #159) fail with Not in scope: type constructor or class SomeStackAnnotation.
I guess that makes sense? Do you think there's other commands that might need it?

@Saizan
Copy link
Copy Markdown
Collaborator Author

Saizan commented May 6, 2026

@alt-romes sorry, spoke too soon, I can trigger the getStackTrace problem on master with smaller imports: issue #310 , testcase #311 .

@alt-romes
Copy link
Copy Markdown
Collaborator

Let me know once ready to review!

@Saizan Saizan force-pushed the issue299-on-abstract branch from 93ecfb2 to b7d9b68 Compare May 7, 2026 08:05
@Saizan
Copy link
Copy Markdown
Collaborator Author

Saizan commented May 7, 2026

@alt-romes I believe it's ready now

Copy link
Copy Markdown
Collaborator

@alt-romes alt-romes left a comment

Choose a reason for hiding this comment

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

only fully qualified names are accepted.

Hmm. Well, that's a tradeoff. I think it's fair, especially if everything is more natural (ie it's obvious what the context is - the breakpoint context - rather than a complicated magic context with implicit things)

At the start of a session we import the exported symbols of:

  • Prelude
  • loaded Debug View modules
  • debugeee home units module

what do you mean by the third item in this list? I thought you changed it so we only have Prelude and the DebugView instances.

Could you also say in the commit message which ticket the commit fixes, if any? Here it's #299. This is important when I'm writing the changelog.

Overall: Looks good, but I have a few questions. I'm glad you understand all of these tricky bits now!

Comment thread haskell-debugger/GHC/Debugger/Monad.hs Outdated
Comment thread haskell-debugger/GHC/Debugger/Monad.hs
Comment thread haskell-debugger/GHC/Debugger/Monad.hs
Comment thread haskell-debugger/GHC/Debugger/Monad.hs
Comment thread haskell-debugger/GHC/Debugger/Session.hs Outdated
Comment thread test/golden/self-debug-cli/self-debug-cli.hdb-stdin Outdated
At the start of a session we import:
- exported symbols from Prelude
- instances from loaded Debug View modules
- instances from debugeee home units modules
(we were importing their inner scope before).
The latter two are so DebugView orphans are in scope.

During an eval, if stopped at a breakpoint, we also import
the inner scope of the breakpoint module.

Imports made by the user at the REPL are as before:
preserved across stops, only for exported symbols.
@Saizan Saizan force-pushed the issue299-on-abstract branch from 9f84251 to b03ba78 Compare May 8, 2026 14:15
@Saizan Saizan requested a review from alt-romes May 8, 2026 14:19
@alt-romes
Copy link
Copy Markdown
Collaborator

Land it! Great work.

@Saizan Saizan merged commit 2e1e474 into master May 8, 2026
4 of 5 checks passed
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.

2 participants