When I load a file from a test-suite, I am getting suggestions to add dependencies to the cabal file that are already listed as dependencies in the test-suite.
Reproducer:
mkdir foo
cd foo
cabal init -n --lib --tests
We now add dependency QuickCheck to the testsuite.
echo " , QuickCheck" >> *.cabal
In Emacs,
load test/Main.hs
add line import Test.QuickCheck
load the file into the haskell-mode with C-c C-l
This will suggest "Add QuickCheck to foo.cabal? (y or n)" and block until an answer is given. (Of course, we do not want to add anything to our cabal file because it is perfectly ok.)
The suggestion seems to be harvested from the error:
Could not load module ‘Test.QuickCheck’.
It is a member of the hidden package ‘QuickCheck-2.14.3’.
Perhaps you need to add ‘QuickCheck’ to the build-depends in your .cabal file.
haskell-mode seems to load the file in the wrong context.
I suspect loading files from test-suites is not supported yet. It would be good if the haskell-mode would warn about the missing feature (and then not making any suggestions on code modification) rather than blindly doing wrong things.
The helpful suggestions by haskell-mode are well-meant, but rather disruptive when they are just garbage, which seems to happen in different scenarios (cf. #1834).
Note: there is a previous instance of this issue that the author closed, but there is no evidence it was fixed:
When I load a file from a test-suite, I am getting suggestions to add dependencies to the cabal file that are already listed as dependencies in the test-suite.
Reproducer:
We now add dependency
QuickCheck
to the testsuite.In Emacs,
test/Main.hs
import Test.QuickCheck
C-c C-l
This will suggest "Add QuickCheck to foo.cabal? (y or n)" and block until an answer is given. (Of course, we do not want to add anything to our cabal file because it is perfectly ok.) The suggestion seems to be harvested from the error:
haskell-mode seems to load the file in the wrong context.
Note: there is a previous instance of this issue that the author closed, but there is no evidence it was fixed:
1535