Providing a smooth default user experience
Duncan Coutts
duncan.coutts at googlemail.com
Fri Nov 2 16:40:15 CET 2012
On Fri, 2012-11-02 at 11:25 +0100, Simon Hengel wrote:
> > Recently, I had to add a MIN_VERSION macro to my code because of the
> > old-time / time change in directory, but couldn't test the library in
> > ghci because the macro was not defined.
> >
> > I discovered that configuring ghci with
> >
> > :set -optP-include -optPdist/build/autogen/cabal_macros.h
> >
> > tells ghci about the macro, but I find this even more cumbersome than
> > dist/build/<executable>/<executable>.
> >
> > So, if I'm not missing something, it may also be comfortable to add a
> >
> > cabal ghci
> >
> > command which tells ghci about cabal's configuration.
>
> You can put the required options in a .ghci file in you project root. I
> use [3] as a starting point for new projects, [2] and [3] are real world
> examples.
>
> `cabal ghci` could still be useful, but I think a general solution is
> not trivial. It would probably need to accept qualified targets, e.g.
> `ghci test:properties` to start ghci in a way suitable for a test-suite
> with the name "properties".
Yes, we have been working on this. Last weekend I was updating the code
for doing the qualified target stuff cabal build exe:foo etc.
> Moreover, it would be awesome if it would regenerate generated source
> files on :reload. I'm not sure if this is feasible without changes to
> GHCi, but a custom macro, e.g.
>
> :cabal-reload
>
> could still work.
The GSoC project that started this off did that, and the necessary
changes are in ghc now.
Duncan
More information about the cabal-devel
mailing list