Reconsidering -Wall and -Wcompat
Herbert Valerio Riedel
hvriedel at gmail.com
Mon Feb 15 09:50:55 UTC 2016
On 2016-02-15 at 04:47:56 +0100, Richard Eisenberg wrote:
> On Feb 14, 2016, at 1:51 PM, Sven Panne <svenpanne at gmail.com> wrote:
>> IMHO, the distinction between "during development" and "outside of it" is purely hypothetical.
> I find this comment quite interesting, as I see quite a large
> difference between these.* For example, I use -Werror during
> development, but not outside it. For me, "during development" is when
> the author can see the output from the compiler. "Outside of it" is
> when the author is not looking at the output.
> When I'm developing, I want to see lots and lots of warnings.
> When I'm building something I downloaded from Hackage, I generally don't care.
> So I wonder if there's a way for the tooling to distinguish between
> development builds and non-dev builds.
You may be interested in the upcoming `cabal.project`-file feature which
besides allowing to specify which .cabal files your multi-package
project is made up of (and tells cabal where your project-root is),
allows to set additional `ghc-options`, specify whether tests/benchmarks
are to be enabled, or request specific cabal flag settings (basically
most things you can set via the CLI as well), or even which GHC compiler
executable to use (rather than picking up whatever's in PATH). This can
be specified for all packages in the project or on per-package
`cabal.project` files have only an effect when you're triggering cabal
invocations from within a source-tree, i.e. when you're in the "during
development" mode. So that would be a good place to specify your
development-mode GHC warning-flag configuration and other
> I know cabal better than stack, so I'll use that as my example. When I
> say `cabal configure --enable-tests; cabal build`, it means I want
> more information about how well this package works. Perhaps with
> --enable-tests, -Wall -Wcompat -Werror should be enabled by
> default. If I just say `cabal install`, I probably don't care so much
> about how well the package is working and can leave off the extra
More information about the ghc-devs