-
Notifications
You must be signed in to change notification settings - Fork 208
force a project type #963
Comments
I don't get errors when I have cabal files around and only have things
installed via nix (and am running hie in a nix-shell). As long as those
cabal files actually include all of your deps, of course, but this is a
useful thing to do anyway since you can use the cabal as the source of
truth and cabal2nix your nix setup (easier to release stuff to hackage
later if you always do this). If cabal can find the packages it needs in
the global ghc env, it will be happy and not need to install anything. Run
`ghc-pkg list` in the nix shell to see what is available in your project.
Be wary though of new build if you are using it. It will make a
.ghc.environment directory that will be picked up by cabal and you must
cabal new-clean to get rid of that cached env. I actually delete that file
every time I enter the shell just to be sure. It is currently not
disable-able in cabal but some fixing is coming. See haskell/cabal#4542 and the related PR.
The only hassle here is to make sure that you manually do a cabal update &&
cabal configure inside the nix shell when you change your nix environment
(and blow away .ghc.envs on entering shells). I have shortcuts in my editor
to restart hie and cabal configure to smooth off these edges. It could be
better, but it's way better than the alternatives! :)
…On Fri, 30 Nov 2018 at 18:24, Matthieu Coudron ***@***.***> wrote:
Using hie on nix, because there is .cabal file and/or dist/ subfolder,
hie/ghc-mod will use the cabal mode which fails with import errors (for
packages installed via nix, I suppose ghc-mod would expect these packages
to have been installed via cabal instead). If I remove the .cabal file,
hie/ghc-mod falls back "to plain GHC project" which works.
My problem is that I use haskdogs to generate haskell tags and this needs
the cabal file to work. Thus I would like to force hie to use a "plain GHC
project" but I don't know how.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#963>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAJt3YdcxDw08yymhT3Q63-cfEn_9bFbks5u0OtGgaJpZM4Y7Nrm>
.
|
This is something I have considered doing for a while now, especially on hie itself where you are working with multiple stack.yaml files and need to be able to specify a particular one. Or sometimes testing stack, sometimes new-build, etc, |
@benkolera I might have had a discrepancy between my cabal file and what was installed via nix as I was experimenting. I added |
@alanz I'd like to add this, but what is the preferred approach here? Should it be a cl flag? What should be provided with the flag? Compiler version to use? Whether or not to use slack? |
@alanz ping. In #942 you write:
but this issue doesn't really seem to describe any particular solution. It seems like having
It might also be nice to have something like a --default-ghc to explicitly override stack usage without needing to specify the compiler. |
Now hie has the option to force using one build tool using explicit |
Using hie on nix, because there is .cabal file and/or dist/ subfolder, hie/ghc-mod will use the cabal mode which fails with import errors (for packages installed via nix, I suppose ghc-mod would expect these packages to have been installed via cabal instead). If I remove the .cabal file, hie/ghc-mod falls back "to plain GHC project" which works.
My problem is that I use haskdogs to generate haskell tags and this needs the cabal file to work. Thus I would like to force hie to use a "plain GHC project" but I don't know how.
The text was updated successfully, but these errors were encountered: