> It would be nice to have a tool that extracts the ghc relevant options
> from the cabal file which then could be used by ghc-mod, hdevtools or
> any other tool that wants to use ghc in conjunction with cabal.
Personally, I would like that very much, and I would be an active user.
Why not just a parameter, much like cabal own behaviour:
cabal build - sane default
cabal build exe:whatever - build executable whatever
babal build lib:whatever - build executable whatever
Its not really critical that the default is a cover all scenario, as long as you have those other options. Then you could just configure an editor (vim) setting to manually tell it what should it do.
I would prefer that, even if it meant a little more configuration work, than having a 'merge all' situation that does, typically, more harm than good.
> I think the "right" way might be to find the associated cabal target
> for the current source file.
I also have doubts that this is possible.