Skip to content

Fix #234 T130b#235

Open
alt-romes wants to merge 3 commits intomasterfrom
wip/romes/234
Open

Fix #234 T130b#235
alt-romes wants to merge 3 commits intomasterfrom
wip/romes/234

Conversation

@alt-romes
Copy link
Copy Markdown
Collaborator

@alt-romes alt-romes commented Mar 25, 2026

Trying to fix #234, potentially #238 at the same time

@alt-romes alt-romes changed the title Look through newtypes for instance mthd argument Fix various bugs Mar 25, 2026
@alt-romes alt-romes force-pushed the wip/romes/234 branch 3 times, most recently from d8da75a to d767796 Compare March 26, 2026 18:15
@alt-romes
Copy link
Copy Markdown
Collaborator Author

@fendor the reason why d767796 still has one testsuite failure is because of orphan instances not being available by default, even if we fully resolve the name of the method being compiled.

So, if we don't set the context to include the hs debugger view modules, we will still display the non-orphan instances properly (because depending on the method name or type with instance means we forcibly load those instances into scope); but not so for the orphan instances to which there are no references anywhere.

Is there a way to force certain modules to be included in the orphan instances set?

Or perhaps we should go back to the design of setting all haskell-debugger-view modules in the context... we just have to figure out why that wasn't working right.

(related: #243)

When we compile at runtime function applications of
debugValue/debugFields to some runtime heap value, we *already* qualify
it with the exact unit-id we discovered at setup for the
haskell-debugger-view (either one in the dependencies closure or an
in-memory one).

So, why did we add those modules to the interactive context with `setContext` too?

Historial accident. Previously, naming a variable in the REPL didn't
print it with the debug view, so perhaps it'd be useful to have the
debugView functions in the environment; second, probably because we
didn't realize the full qualification of the methods in
`findDebugViewInstance` originally were sufficient.

Removing these imports also means we won't introduce potential conflicts
unnecessarily.

Fixes #224
This reverts commit d767796.

We must still add the debugger-view modules to the context because
otherwise the built-in orphan instances (e.g. for `Text`) are not made
available.
Previously, they were just being added to each home unit's dflags but
not to the interactive unit's dflags.

Now that we do not forget the flags, we need to drop the -fno-it we were
adding previously (that was completely ignored before); since we depend
on binding @it@ to bind variables at the REPL on every evaluation!
@alt-romes alt-romes changed the title Fix various bugs Fix #234 T130b Mar 30, 2026
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.

Custom debug view instances do not work on newtypes

1 participant