-
Notifications
You must be signed in to change notification settings - Fork 206
cabal project with multiple targets #1006
Comments
I managed to get this project set up without nix or stack, and using new-build. It complains about a missing optparse-applicative library when opening I will have to investigate. |
Many thanks for investigating! I wouldn't mind to get started hacking on HIE, but for now the interplay between cabal, ghc_mod, HIE and emacs remains a bit of a mystery to me. If you have any concrete pointer as to how to tackle this issue, I'd be happy to get involved. For now, my workaround is to add all dependencies globally in the package.yaml, which causes hpack to add them to each target. |
I will be investigating this in detail, it is a problem with the new-build support. And that is a very complex beast, with lots of moving parts. |
I have this same problem on Emacs 26.1+LTS-14.5. Intero is correctly reading targets, but something in the HIE stack won't use a test target, meaning dependencies break, and testing modules can't be found. I loooove HIE and want to make it work, any guesses? EDIT: seems related #644 it looks like this may be from |
K. solved for now at least, just gotta start fresh:
|
Fixed now with #1126 afaict. Please reopen if it isnt. |
I am using nix, HIE (via https://github.com/domenkozar/hie-nix) & emacs to hack on my project here: https://github.com/sboehler/beans/tree/6524a34f85b758d055eaa923fa9005463f7b91d1. My workflow is to enter a nix-shell (see shell.nix for exact config) to to use cabal new-style build commands. I also start emacs with the recommended lsp-* packages from within the nix-shell.
When I edit any Haskell file under /src (cabal's lib:beans target), all imports are correctly detected. However, when opening a file located under /app (exe:beans target) or /tests (test:test target), HIE willl not recognize imports which are not listed under the dependencies of lib:beans in beans.cabal / package.yaml. For eample, the tasty test framework is only listed as a dependency of test:test, hence HIE reports imports from tasty as unknown.
It seems that for some reasons, only dependencies for the library target in a cabal file are detected. I am not familiar with how HIE works and whether this behavior is expected. Ideally, HIE should be aware of the corresponding cabal target of a source file and use the correct dependency list.
(Edit: replaced link to project with link to specific commit where the issue is reproducible)
The text was updated successfully, but these errors were encountered: