title: What is the easiest command for issuing a cabal build, when coding Haskell in Emacs?
body: <p>I have recently switched from vim to Emacs. In which, apparently, the standard workflow is always staying in one running instance with multiple opened files. (I'm not yet convinced this is really superior to the alternative I'm used to, "quit-grep-vi-edit-quit-compile etc." or multiple terminal windows / tabs, but at least I'm giving it a try. Anyway...)</p>
  
  <p>So for compiling a file/project, the usual thing to do seems <code>M-x compile</code> (or shotcuts to it). That lets you specify a compilation command, by default offering <code>make -k</code>. Which may be a reasonable guess for the project most Emacs hackers tend to do; but in Haskell I obviously tend towards <code>cabal</code>, no makefiles at all. And even when I specify <code>cabal build</code>, it doesn't work because the command is executed from the <em>file</em>'s directory, which is not where the <code>.cabal</code> file is.</p>
  
  <p>At the moment, I find myself counting the module-hierarchy depth and typing</p>
  
  <pre><code>M-x "compile" Enter Bckspc Bckspc ... "cd ../../../; cabal build" Enter
  </code></pre>
  
  <p>this doesn't feel right!</p>
  
  <p>Is there some nicer alternative, or should I just go back to my old workflow even though it's not idiomatic Emacs usage?</p>