[Haskell-cafe] Hdevtools cabal support

Daniel Trstenjak daniel.trstenjak at gmail.com
Fri Feb 21 10:04:24 UTC 2014


Hi Maxim,

> I'm pretty new to Haskell, but was doing Haskell development for
> several month. I'm fan of Vim editor and was happy to find out that
> there are good tools to support Haskell development with Vim, e.g.
> vim-hdevtools. But it turned out that it not of much use in my project
> where we rely on Cabal packages and sandboxes.

You don't need to modify hdevtools to get support for cabal sandboxes.
But you have to tell hdevtools the position of the package database of
the cabal sandbox.


For vim you could use something like:

function! s:FindCabalSandbox()
   let l:sandbox    = finddir('.cabal-sandbox', './;')
   let l:absSandbox = fnamemodify(l:sandbox, ':p')
   return l:absSandbox
endfunction

function! s:FindCabalSandboxPackageConf()
   return glob(s:FindCabalSandbox() . '*-packages.conf.d')
endfunction

function! s:HaskellSourceDir()
   return fnamemodify(s:FindCabalSandbox(), ':h:h') . '/src'
endfunction

let g:hdevtools_options  = '-g-package-conf=' . s:FindCabalSandboxPackageConf()
let g:hdevtools_options .= ' ' . '-g-i' . s:HaskellSourceDir()


This also assumes, that your Haskell source code is contained in a
directory named 'src' which lies in the same directory then your
projects cabal file.


Using hdevtools this way is more generic than modify it, because this
solution also works for cabal-dev or any other package database.


Greetings,
Daniel


More information about the Haskell-Cafe mailing list