Ticket #883 (new enhancement)

Opened 21 months ago

Last modified 15 months ago

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

Reported by: barsoap Owned by:
Priority: normal Milestone: cabal-install-0.16
Component: cabal-install tool Version: 1.8.0.6
Severity: normal Keywords:
Cc: Difficulty: unknown
GHC Version: Platform:

Description

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)

Change History

Changed 21 months ago by barsoap

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

Changed 15 months ago by kosmikus

  • milestone set to cabal-install-0.16

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

Note: See TracTickets for help on using tickets.