[GHC] #8997: Warn about unused parameters in recursive definitions
GHC
ghc-devs at haskell.org
Tue Apr 15 08:54:09 UTC 2014
#8997: Warn about unused parameters in recursive definitions
------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: feature request | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.8.2
Keywords: | Operating System: Unknown/Multiple
Architecture: Unknown/Multiple | Type of failure: None/Unknown
Difficulty: Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: |
------------------------------------+-------------------------------------
I’m correcting student’s exams right now; a good source of bad programs
:-)
Consider this program:
{{{
foo _ y [] = y
foo z y (_:xs) = foo z y xs
}}}
It would be nice if GHC would warn that the first parameter of `foo` is
not used. IIRC GHC warns about unused constructors even when they occur on
RHSs.
If `foo` is passed to some higher order function that expects a particular
type, removing the parameter would require a wrapper for there, or at
least an anonymous lambda... but it’s probably still worth notifying the
programmer, as more likely there is a bug or misunderstanding in such
code.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8997>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list