Having to manually set up cabal target explicitly won't work if you e.g. develop a library and unit tests for it and switch between test and library modules (which are obviously different targets in cabal file).

I think the best approach would be to determine a first cabal target source file belongs to and using it. This won't expose problems that would occur bulding other targets that also use that file, but I guess it is ok.

Also, I was thinking about adding suport for passing cabal options to allow e.g. using different flags.



On Fri, Feb 21, 2014 at 4:37 PM, João Cristóvão <jmacristovao@gmail.com> wrote:
> 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.

Cheers,
João


2014-02-21 12:22 GMT+00:00 Daniel Trstenjak <daniel.trstenjak@gmail.com>:


Hi Alan,

On Fri, Feb 21, 2014 at 02:09:28PM +0200, AlanKim Zimmerman wrote:
> In terms of using the right section of cabal, in the dev/editor environment you
> actually need to union of all the cabal targets, so all the various hs-src
> directories etc are in scope.

You might get an issue by doing it that way, just think about two
executables having modules with the same name.

I think the "right" way might be to find the associated cabal target
for the current source file.

But I don't know if it's possible to always get a unique cabal target.


Greetings,
Daniel
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe