MercuryTechnologies/ghciwatch

[DUX-2107] Eval commands fail with "module is defined in multiple files"

9999years opened this issue · 0 comments

Our favorite bug is back! We have a situation where ghciwatch loads all the modules at the start of the session, so they're all loaded:

ghci> :show targets
Foo
Bar
Baz

Then, an eval command in (for example) module Foo is executed. To start with, the module is added and explicitly interpreted:

ghci> :add *src/Foo.hs

Unfortunately, this always uses the module path (see #171), so if ghciwatch wasn't the one to load the module (e.g. it was loaded at the start of the session), the module path and module name will conflict and lead tot he dreaded "module is defined in multiple files".

See: https://gitlab.haskell.org/ghc/ghc/-/issues/13254#note_525037

Solution

I think we can fix this by keeping track of how each module is added to the session — as a path or as a module name — and then only using that form going forward.

From SyncLinear.com | DUX-2107