Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Single command to figure out ghc[i] options needed to compile a single file #873

bos opened this Issue May 24, 2012 · 2 comments


None yet
1 participant

bos commented May 24, 2012

(Imported from Trac #883, reported by barsoap on 2011-09-15)

I'm thinking of a cabal options <file.hs> command that

  1. locates the proper .cabal file for <file.hs>
  2. parses that .cabal
  3. outputs all options necessary to compile that file as cabal build would do it, that is, -isrc -idist/build/autogen (-Xwhatever)* -hide-all-packages (-package-id whatever)*

There's already cabal-ghci on hackage which has one half of the equation, but packages are missing. (which happen to be available via grep and sed from cabal_macros.h...)

Needing those options comes up when e.g. working with vim's haskellmode on a cabal project: Most if not all cabal projects' files just fail to compile with default options. Having such a command would give a bullet-proof, non-hackish and low-tech way to integrate cabal with any such IDE tool.

(Do note that just building with cabal isn't enough, while haskellmode can parse the resulting warnings and errors, it doesn't stand a chance to figure out types, among other things, that way)


bos commented May 24, 2012

(Imported comment by barsoap on 2011-09-15)

Just for completeness' sake, some evil hackery: http://hpaste.org/51363


bos commented May 24, 2012

(Imported comment by @kosmikus on 2011-09-15)

This is probably "fixed" by cabal repl once it becomes available, or by projects such as cabal-dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment