Consider the following simple Haskell program.

---8<---
import System

data Foo = Bar
         | Baz
         deriving (Eq,Ord)

main :: IO ()
main = do { argv <- getArgs
          ; case argv of
              ["forty-two"] -> print "HHGTTG"
              _otherwise    -> print "oh well"
          }
---8<---

With this morning's ghc-4.03 and the -Wall option, I get the
following:

---8<---
sphere$ /homes/kw217/Scratch/Builds/i386-unknown-linux/fptools-4.xx-cvs/
ghc/driver/ghc-4.03 Test.hs -Wall

Test.hs:11: Warning: Defined but not used: _otherwise
Note: renameSourceCode found warnings 
                                      Test.hs:3: Warning: Defined but 
not used: cmp_eq{-ryO-}
                                      
                                      <compiler-generated-code>:
                                          Warning: definition but no 
type signature for
                                                   
`con2tag_Foozh{-rxq-}'
ghc-4.03: module version unchanged at 2
sphere$ 
---8<---

Notice three things here.

1. Despite the following comment in the CVS log for 1999/01/14 17:59:10 
sof:

  * _ as lower-case letter, "_" is a reserved id. Prefixing unused
    variable names in patterns with '_' causes the renamer not to
    report such names as being unused.

we are getting a warning for `_otherwise'.

2. The formatting of the next two warnings leaves something to be
desired.

3. The warnings for cmp_eq and Foo# relate to internal GHC-generated
code, rather than anything the programmer has done wrong.  (except
perhaps that the Eq and Ord dictionaries are not used; but then the
error message is rather unclear).

--KW 8-)

-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [><] )       :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.    :
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED]     :
:---------------------------------------------------------------------:

Reply via email to