Skip to content

Report unused pattern bindings

Henning says: recently, I was a bit suprised that GHC didn't warn about useless where definitions such as the following when using -Wall (and I couldn't find a respective warning GHC CLI flag which would have enabled reporting a warning in this case -- unless I missed it)

module Foo where

foo :: Int -> Int
foo n = n + 1
   where
     Nothing = Just n

I think that there should be a warning for the unused pattern binding.

Trac metadata
Trac field Value
Version 7.4.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information