Misleading GHCi errors when package is installed
When a package is installed in a cabal sandbox/global package directory and code is loaded with GHCi when a file has been deleted, GHCi gives very misleading errors.
First, if we don't install the package, we get the correct error/expected result:
> mv B.hs B.hs.old
> ghci Main.hs
Main.hs:3:1: error:
Failed to load interface for ‘B’
Use -v to see a list of the files searched for.
Failed, modules loaded: A.
But if we first install the package, we get a very strange error:
> mv B.hs.old B.hs
> cabal install
> mv B.hs B.hs.old
> ghci Main.hs
Main.hs:6:14: error:
Ambiguous occurrence ‘str’
It could refer to either ‘A.str’,
imported from ‘A’ at Main.hs:2:1-8
(and originally defined at A.hs:7:1-3)
or ‘B.str’,
imported from ‘B’ at Main.hs:3:1-8 (and originally defined in ‘A’)
Failed, modules loaded: A.
I'm using GHC 8.0.1, cabal-install-1.24.0.0, and Cabal Library-1.24.0.0.
This is Very Annoying because I use this process to minimize examples. For example, when I want to simplify code by removing a module, I just delete it and then rely on GHCi to tell me what I need to update. Anyone not aware of this bug would be totally confused by the error, and even though I do know about the bug, the error is completely unhelpful.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |