0

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?

2 Answers2

0

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).

Sean Clark Hess
  • 15,859
  • 12
  • 52
  • 100
  • confirmed; effortlessly got [hdevtools for Vim](https://github.com/bitc/vim-hdevtools) working via the linked blog post. Looking forward to more tooling for Haskell, huzzah! –  Aug 19 '15 at 08:57
  • oops, there is always something - while running vim and global installed hdevtools in an existing project, I had to run ``stack exec --no-ghc-package-path -- vim`` in order to get things running smoothly. –  Aug 19 '15 at 09:11
  • That's strange. It works in macvim just fine without doing that. I just switched to neovim, I'll see if it's still working as expected. – Sean Clark Hess Aug 19 '15 at 15:56
  • It's definitely working for me without needing to stack vim via stack exec. I'm using nvim, and I just run `nvim` in my terminal and it works. – Sean Clark Hess Aug 24 '15 at 15:56
0

This blogpost gives a nice introduction as well. Things change quickly in the haskell world and ghc-mod seems to be working well with stack now. The setup from the post requires neovim though.

The setup from the post worked perfectly fine for me and found all dependencies within the current stack project.

StarSheriff
  • 1,477
  • 2
  • 17
  • 23