[Haskell-cafe] Using Cabal during development
Jonathan Rockway
jon at jrock.us
Fri Feb 12 12:27:57 EST 2010
* On Tue, Feb 09 2010, Johan Tibell wrote:
> On Tue, Feb 9, 2010 at 6:10 AM, Ketil Malde <ketil at malde.org> wrote:
>
> Limestraël <limestrael at gmail.com> writes:
>
> > how do usually Haskell developpers build their softwares (and
> > especially medium or big libraries) while they are still developping them ?
> > With cabal-install, by doing one 'cabal configure' once and 'cabal build'
> > each time they have altered their code ?
> > With only Cabal, through some 'runhaskell Setup.hs build's ?
>
> Generally, the first thing I do is hit C-c C-l in Emacs to load the
> current file into a haskell process. Then back to fix the type errors
> (click on the error to jump to the code), and iterate until it loads
> correctly.
>
> It's really unfortunate that this approach doesn't work for .hsc files. When writing
> low level libraries I often have a couple of these which forces me out of my nice
> Emacs workflow into an Emacs + terminal + Cabal workflow.
This is solve-able. I bind compile-command to the c2hs invocation, and
then have my C-c C-l keybinding run "compile" before
"inferior-haskell-load-file". The only hangup is that having a -*-
comment at the top of a c2hs file confuses ghc when c2hs generates the
code. So I set the buffer-local variable via eproject (in the .eproject
file in the project root) instead, and everything is happy.
I would post the exact code, but it's on my work machine, and it's
nearly impossible to get files out of my work environment without
getting nasty emails about how I'm stealing the company's IP. (But hey,
at least I get to use Haskell. I can't complain too loudly :)
Ping me on #haskell or #emacs if you need help getting something like
this working.
Oh; one other thing. You don't need to leave emacs to run cabal
commands; you can run ":!cabal build" from the ghci window, you can bind
compile-command to "cabal build" and run M-x compile, or you can use
eshell. I use all three approaches depending on my mood. But since I'm
on Windows, I certainly never venture outside of my Emacs window. :)
Regards,
Jonathan Rockway
--
Just "another Haskell hacker"
More information about the Haskell-Cafe
mailing list