#7397: -fwarn-irrefutable-patterns
-----------------------------+----------------------------------------------
Reporter:  chrisdone         |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  7.6.1             |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  None/Unknown      |      Blockedby:                  
Blocking:                    |        Related:                  
-----------------------------+----------------------------------------------
 Had a search around and didn't see such a request, apologies if already
 proposed.

 Would it be possible and make sense to warn when an irrefutable pattern
 has more than one case? Example:

 {{{
 data Query = GetTheStuff Int
 foo x = bar where
   GetTheStuff n = x
 }}}

 If I (or someone else) later go and add a new constructor to GetTheStuff,
 I'm not made aware of this use here. Obviously irrefutable patterns should
 only be used for things with one data structure (or if you're bold enough
 to think the other case won't happen—I'm more paranoid).

 This has bitten me only a couple times, probably others only a few times.
 Maybe it's not a huge deal? But if it's really trivial to add, could be
 nice? I'm just proposing this here. I might try implementing it myself, it
 ''sounds'' easy.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7397>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to