bad check for "Defined but not used"

Simon Peyton-Jones simonpj at microsoft.com
Thu May 16 04:00:17 EDT 2002


GHC's notion of "unused" is broken in ways that are not trivial
to fix.  It's been on my wish list for ages...but it's not a very
exciting problem to tackle.

Simon

| -----Original Message-----
| From: Feliks Kluzniak [mailto:feliks at crt.se] 
| Sent: 15 May 2002 19:31
| To: glasgow-haskell-bugs at haskell.org
| Subject: bad check for "Defined but not used"
| 
| 
| 
| Hello,
| 
| It seems that the check for functions that are defined, but 
| not used does not ignore direct recursion (see below: there 
| is only one warning).
| 
| I think this is not quite right.  When I compile a module, I 
| would find it very helpful to get information about 
| "unreachable code", i.e., about functions that are not 
| accessible from any of the exported functions (or from "main" 
| for the main module).  I don't really care whether a 
| disconnected part of the call graph contains cycles - what I 
| want to know is that it is disconnected.
| 
| Am I missing something?
| 
| Regards,
| -- Feliks
| 
| 
| ---------------------
| module See () where
| 
| foo ::  Int -> Int
| 
| foo n  =  n + 1
| 
| 
| fun ::  Int -> Int
| 
| fun 0  =  0
| 
| fun n  =  fun (n - 1)
| 
| -----------------------
| ghc-5.02.3: chasing modules from: see.hs
| Compiling See              ( see.hs, ../GHC/see.o )
| 
| see.hs:5: Warning: Defined but not used: foo
| --------------------- _______________________________________________
| Glasgow-haskell-bugs mailing list 
| Glasgow-haskell-bugs at haskell.org 
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
| 



More information about the Glasgow-haskell-bugs mailing list