Re: build failures when hiding non-visible imports

From: Brandon Allbery
On Sat, Aug 18, 2012 at 9:10 PM, Carter Schonwald < carter.schonwald@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. John L.

On 21 August 2012 07:36, John Lato
From: Brandon Allbery
On Sat, Aug 18, 2012 at 9:10 PM, Carter Schonwald < carter.schonwald@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.
+1 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 ...) Conrad.

OK we're doing this for 7.6. See http://hackage.haskell.org/trac/ghc/ticket/7167
| -----Original Message-----
| From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-
| haskell-users-bounces@haskell.org] On Behalf Of Conrad Parker
| Sent: 21 August 2012 01:02
| To: John Lato
| Cc: glasgow-haskell-users@haskell.org
| Subject: Re: build failures when hiding non-visible imports
|
| On 21 August 2012 07:36, John Lato
participants (3)
-
Conrad Parker
-
John Lato
-
Simon Peyton-Jones