I just went through this pain, here is my vimrc for hdevtools
(specific for ghc782, just update this line: let l:nixextra =
'-g-package-db=' . system('nix-store -qR $(which ghc) | tail -n1 | tr
-d "\n" ') . '/lib/ghc-7.8.2/package.conf.d' ):

cabal-cargs may help you as well as finding the correct
pacakage.conf.d in the store. I'm not sure why ghc-mod has no problem,
but hdevtools does.

###########################################

au FileType haskell nnoremap <buffer> <F1> :HdevtoolsType<CR>
                                         au FileType haskell nnoremap
<buffer> <silent> <F2> :HdevtoolsClear<CR>
au FileType haskell nnoremap <buffer> <silent> <F3> :HdevtoolsInfo<CR>
                                      au FileType haskell nnoremap
<buffer> <silent> <F4> :GhcModLintAsync<CR>

function! s:CabalCargs(args)"{{{
   let l:output = system('cabal-cargs ' . a:args)
if v:shell_error != 0
      let l:lines = split(l:output, '\n')
      echohl ErrorMsg
      echomsg 'args: ' . a:args
      for l:line in l:lines
         echomsg l:line
      endfor
      echohl None
      return ''
   endif
   return l:output
endfunction"}}}

function! s:HdevtoolsOptions()"{{{
    let l:params = '--format=hdevtools --sourcefile=' .
shellescape(expand('%'))
    let l:cargs  = s:CabalCargs(l:params . ' ' .
'--ignore=build_depends')
    let l:deps   = s:CabalCargs(l:params . ' ' . '--allsections
--only=build_depends')
    let l:nixextra = '-g-package-db=' . system('nix-store -qR $(which
ghc) | tail -n1 | tr -d "\n" ') . '/lib/ghc-7.8.2/package.conf.d'
    return l:cargs . ' ' . '-g-hide-all-packages' . ' ' . l:deps . ' '
. l:nixextra
endfunction"}}}

autocmd Bufenter *.hs :call s:InitHaskellVars()

function! s:InitHaskellVars()"{{{
   if filereadable(expand('%'))
      let g:hdevtools_options = s:HdevtoolsOptions()
   endif
endfunction"}}}
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to