build failures when hiding non-visible imports
conrad at metadecks.org
Tue Aug 21 02:01:41 CEST 2012
On 21 August 2012 07:36, John Lato <jwlato at gmail.com> wrote:
>> From: Brandon Allbery <allbery.b at gmail.com>
>> On Sat, Aug 18, 2012 at 9:10 PM, Carter Schonwald <
>> carter.schonwald at gmail.com> wrote:
>>> meaning: flags for treating it as a warning vs as an error? (pardon, i'm
>>> over thinking ambiguity in phrasing).
>>> if thats the desired difference, that sounds good to me!
>> I would expect it means that, having demoted it to a warning, we would have
>> -fwarn-hiding-no-target / -fno-warn-hiding-no-target (or whatever we call
>> it) as with all other warnings.
>> For warning vs. error, it seems to me that should be more general: perhaps
>> taking any of the -f[no-]warn-* options and replacing "warn" with "err".
> Yes. To be concrete, this is what I would like to see.
> In a statement of the form:
> import Module hiding (x)
> where Module doesn't export x, ghc should report a warning instead of an error
> This warning would be enabled/disabled by the usual flags (I like
> -fwarn-unused-import-hiding, but -fwarn-hiding-no-target is good too).
> The warning would be on by default.
> If a user wants this to be an error, I think -Werror should be
> sufficient. I am unable to think of any case where hiding a
> non-visible symbol would lead to errors on its own, and any errors
> likely to occur in tandem with this issue already have their own, more
> helpful, error conditions (e.g. symbols not in scope, symbols in a
> qualified import list not visible).
> I agree with Ganesh's point that it would be beneficial to have this
> available for ghc-7.6.1 if possible.
and it must be a warning (not error) by default, or else we will need
to tell everyone to use "cabal install
--ghc-option=-fwarn-unused-import-hiding" to install lots of packages
on hackage (currently including things like HTTP and
gtk2hs-buildtools, which are pulled in by many packages).
Also, if this remains an error by default then it will become a
sensible coding style to simply avoid using import hiding, to avoid
build errors that will occur when some other library removes an
interface (that you have explicitly marked as unused ...)
More information about the Glasgow-haskell-users