RE: ghc warnings messed up in 6.01

2003-12-16 Thread Simon Peyton-Jones
Done, I believe.  It'll be in the next release (6.3/6.4).

Simon

| -Original Message-
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-users-
| [EMAIL PROTECTED] On Behalf Of Mike Gunter
| Sent: 07 December 2003 16:50
| To: [EMAIL PROTECTED]
| Subject: Re: ghc warnings messed up in 6.01
| 
| 
| Simon seems to have agreed that The Right Thing is to treat bindings
| with names beginning with an underscore as if they are used w.r.t. to
| the bindings they use (they're already treated as used w.r.t. warnings
| for themselves.)  With this enhancement (and the other warning fixes
| apparently already in HEAD), you should be able to change ds to
| _ds and get no warnings.
| 
| BTW (here's the real point of my message :-)), is this enchancement
| planned?  For when?  Thanks.
| 
|   mike
| 
| 
|  has anyone else noticed that the warnings generated by ghc appear to
|  have become quite incorrect in many cases?
| 
|  in particular, the 'defined but not used' warning is generated
|  spuriously a lot. almost as if it is being checked after dead code
|  elimination and desugaring of some sort..
| 
|  here is an example which touches all the reproducable bugs I have
found.
| 
|  module Main(main) where
|  import List(nub)
|  import Monad()
| 
|  as = repeat 'a'
|  bs = repeat 'b'
|  ds = nub as
| 
|  cs = [(a,b) | a - as | b - bs]
| 
|  main = print $ take 10 cs
| 
| 
|  ;ghc -W -fglasgow-exts  Foo.hs
| 
|  Foo.hs:1:
|  Warning: Module `List' is imported, but nothing from it is used
|   (except perhaps instances visible in `List')
| 
|  Foo.hs:1:
|  Warning: Module `Monad' is imported, but nothing from it is used
|   (except perhaps instances visible in `Monad')
| 
|  Foo.hs:7: Warning: Defined but not used: ds
| 
|  Foo.hs:9: Warning: Defined but not used: b
| 
|  Foo.hs:9: Warning: Defined but not used: a
| 
| 
|  notice:
| 
|  1) it claims nothing is used by List, when 'nub' definatly is being
|  used. (technically true, since ds is not used, but this warning is
more
|  confusing than anything. my first inclination is to delete the
import
|  line, causing the program to fail to compile, the only fix seems to
be
|  to track down the root by hand)
| 
|  2) it claims Monad is unused, when I specifically imported it with
()
|  meaning I don't want any names from it. (i.e., I just want
instances)
| 
|  3) defined but not used 'ds': yay! the only valid warning.
| 
|  4,5) variables bound in parallel list comprehensions always seem to
|  generate warnings.
| 
| 
|  AFAIK, none of these were problems in earlier versions of ghc, they
are
|  quite anoying as they obscure valid warnings. my guess is some
|  desugarings and warning passes were accidentally switched around..
|  problem 1 is particularly bad, since a single unused toplevel could
|  cascade to generating a ton of warnings, all of which must be sorted
|  through to find the actual cause. the others are just anoying as
there
|  doesn't seem to be a workaround short of disabling warnings.
| 
|  John
|  --
| 

---
|  John Meacham - California Institute of Technology, Alum. -
[EMAIL PROTECTED]
| 

---
|  ___
|  Glasgow-haskell-users mailing list
|  [EMAIL PROTECTED]
|  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
| ___
| Glasgow-haskell-users mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


ghc warnings messed up in 6.01

2003-12-07 Thread John Meacham
has anyone else noticed that the warnings generated by ghc appear to
have become quite incorrect in many cases?

in particular, the 'defined but not used' warning is generated
spuriously a lot. almost as if it is being checked after dead code
elimination and desugaring of some sort..

here is an example which touches all the reproducable bugs I have found.

 module Main(main) where
 import List(nub)
 import Monad()
 
 as = repeat 'a'
 bs = repeat 'b'
 ds = nub as
 
 cs = [(a,b) | a - as | b - bs]
 
 main = print $ take 10 cs


;ghc -W -fglasgow-exts  Foo.hs

Foo.hs:1:
Warning: Module `List' is imported, but nothing from it is used
 (except perhaps instances visible in `List')

Foo.hs:1:
Warning: Module `Monad' is imported, but nothing from it is used
 (except perhaps instances visible in `Monad')

Foo.hs:7: Warning: Defined but not used: ds

Foo.hs:9: Warning: Defined but not used: b

Foo.hs:9: Warning: Defined but not used: a


notice:

1) it claims nothing is used by List, when 'nub' definatly is being
used. (technically true, since ds is not used, but this warning is more
confusing than anything. my first inclination is to delete the import
line, causing the program to fail to compile, the only fix seems to be
to track down the root by hand)

2) it claims Monad is unused, when I specifically imported it with ()
meaning I don't want any names from it. (i.e., I just want instances)

3) defined but not used 'ds': yay! the only valid warning.

4,5) variables bound in parallel list comprehensions always seem to
generate warnings.  


AFAIK, none of these were problems in earlier versions of ghc, they are
quite anoying as they obscure valid warnings. my guess is some
desugarings and warning passes were accidentally switched around..
problem 1 is particularly bad, since a single unused toplevel could
cascade to generating a ton of warnings, all of which must be sorted
through to find the actual cause. the others are just anoying as there
doesn't seem to be a workaround short of disabling warnings.

John
-- 
---
John Meacham - California Institute of Technology, Alum. - [EMAIL PROTECTED]
---
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ghc warnings messed up in 6.01

2003-12-07 Thread Sven Panne
John Meacham wrote:
[...] ;ghc -W -fglasgow-exts  Foo.hs
The current HEAD version (no idea about the release branch) of ghc correctly
says:
Foo.hs:1:
Warning: Module `List' is imported, but nothing from it is used
 (except perhaps instances visible in `List')
Foo.hs:7: Warning: Defined but not used: ds

[...] problem 1 is particularly bad, since a single unused toplevel could
cascade to generating a ton of warnings, all of which must be sorted
through to find the actual cause. [...]
This is your personal opinion and actually a matter of taste: I prefer the
new transitive way of issuing the warnings, otherwise you only get a
single warning about ds being unused, remove it, recompile, get the next
warning, etc. etc. With the new way you can simply remove everything which
appears in the unused foo warnings and you're done.
Cheers,
   S.
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: ghc warnings messed up in 6.01

2003-12-07 Thread Mike Gunter

Simon seems to have agreed that The Right Thing is to treat bindings
with names beginning with an underscore as if they are used w.r.t. to
the bindings they use (they're already treated as used w.r.t. warnings
for themselves.)  With this enhancement (and the other warning fixes
apparently already in HEAD), you should be able to change ds to
_ds and get no warnings.

BTW (here's the real point of my message :-)), is this enchancement
planned?  For when?  Thanks.

mike


 has anyone else noticed that the warnings generated by ghc appear to
 have become quite incorrect in many cases?

 in particular, the 'defined but not used' warning is generated
 spuriously a lot. almost as if it is being checked after dead code
 elimination and desugaring of some sort..

 here is an example which touches all the reproducable bugs I have found.

 module Main(main) where
 import List(nub)
 import Monad()
 
 as = repeat 'a'
 bs = repeat 'b'
 ds = nub as
 
 cs = [(a,b) | a - as | b - bs]
 
 main = print $ take 10 cs


 ;ghc -W -fglasgow-exts  Foo.hs

 Foo.hs:1:
 Warning: Module `List' is imported, but nothing from it is used
  (except perhaps instances visible in `List')

 Foo.hs:1:
 Warning: Module `Monad' is imported, but nothing from it is used
  (except perhaps instances visible in `Monad')

 Foo.hs:7: Warning: Defined but not used: ds

 Foo.hs:9: Warning: Defined but not used: b

 Foo.hs:9: Warning: Defined but not used: a


 notice:

 1) it claims nothing is used by List, when 'nub' definatly is being
 used. (technically true, since ds is not used, but this warning is more
 confusing than anything. my first inclination is to delete the import
 line, causing the program to fail to compile, the only fix seems to be
 to track down the root by hand)

 2) it claims Monad is unused, when I specifically imported it with ()
 meaning I don't want any names from it. (i.e., I just want instances)

 3) defined but not used 'ds': yay! the only valid warning.

 4,5) variables bound in parallel list comprehensions always seem to
 generate warnings.  


 AFAIK, none of these were problems in earlier versions of ghc, they are
 quite anoying as they obscure valid warnings. my guess is some
 desugarings and warning passes were accidentally switched around..
 problem 1 is particularly bad, since a single unused toplevel could
 cascade to generating a ton of warnings, all of which must be sorted
 through to find the actual cause. the others are just anoying as there
 doesn't seem to be a workaround short of disabling warnings.

 John
 -- 
 ---
 John Meacham - California Institute of Technology, Alum. - [EMAIL PROTECTED]
 ---
 ___
 Glasgow-haskell-users mailing list
 [EMAIL PROTECTED]
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users