How to make vim-haskellmode and cabal-dev work together?

I am using the haskellmode-vim plugin . Unfortunately, it does not work very well with cabal-dev (apparently, it directly calls GHC). Now I'm wondering if there is a way to get haskellmode to work in a project managed by cabal-dev (ideally, without any special project settings?). For this, I only found something pointing to ghcmod, and I'm not sure how this will help in this case.

+3
source share
1 answer

I just figured it out for myself with some significant help #haskellon freenode.

In your .vimrc you should have the following lines (maybe already if you have hdevtools and cabal-dev setting)

http://lpaste.net/94999 . , .

function! FindCabalSandboxRoot()
    return finddir('.cabal-sandbox', './;')
endfunction

function! FindCabalSandboxRootPackageConf()
    return glob(FindCabalSandboxRoot().'/*-packages.conf.d')
endfunction

let g:hdevtools_options = '-g-ilib -g-isrc -g-i. -g-idist/build/autogen -g-Wall -g-package-db='.FindCabalSandboxRootPackageConf()

haskellmode-vim .vimrc:

au Bufenter *.hs compiler ghc

haskellmode-vim, ghc ghc_staticoptions, , , cabal-dev.

au Bufenter *.hs let b:ghc_staticoptions = '-ilib -isrc -i. -idist/build/autogen -Wall -package-db='.FindCabalSandboxRootPackageConf()

, SO, haskellmode-vim , . , .

+1

All Articles