Search code examples
vimghccabalsyntastichaskell-stack

Synastic errors - Vim, Stack, Haskell development


I am using stack for my Haskell development and Syntastic for my error checking when editing in Vim. I have not installed the haskell-platform, instead, I use a stack build --install-ghc to get my environment up and running using the supported GHC, cabal and lts packages.

Normally, I use a cabal sandbox and syntastic works well with this. I see when I do a let g:syntastic_debug=3 in Vim, syntastic runs a cabal configure which checks if the project dependencies are installed and then goes ahead and does some hlint, hdevtools and ghc-mod magic to give me some warnings and/or error messages.

Now, here is my problem. Since my cabal setup (installed from stack) doesn't know about my dependencies installed at .stack-work or .stack (not sure), it complains that I am missing necessary packages and blows up when syntastic runs in my Vim instance.

Trying to run a stack exec -- cabal configure returns the following error:

Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal. use the flag --package-db to specify a package database (it can be used multiple times).

I haven't found out how to pass the --package-db option with the correct database. Nothing seems to work there.

So, the quetion - will successfully running a stack exec -- cabal configure, avoiding the GHC_PACKAGE_PATH issue get me to a working setup? Can anyone give me some direction here?


Solution

  • hdevtools works. See here: http://seanhess.github.io/2015/08/05/practical-haskell-editors.html

    I'm planning on keeping that up to date as new tools come out (like stack-ide).