bad check for "Defined but not used"

Feliks Kluzniak feliks at crt.se
Wed May 15 14:30:54 EDT 2002


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
---------------------



More information about the Glasgow-haskell-bugs mailing list