[GHC] #11253: Duplicate warnings for pattern guards and relevant features (e.g. View Patterns)

GHC ghc-devs at haskell.org
Fri Dec 18 14:19:03 UTC 2015


#11253: Duplicate warnings for pattern guards and relevant features (e.g. View
Patterns)
-------------------------------------+-------------------------------------
           Reporter:  gkaracha       |             Owner:  gkaracha
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.11
           Keywords:  pattern        |  Operating System:  Unknown/Multiple
  matching, exhaustiveness           |
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #595
Differential Rev(s):                 |         Wiki Page:
                                     |  PatternMatchCheck,
                                     |  PatternMatchCheckImplementation
-------------------------------------+-------------------------------------
 There are some cases where the new exhaustiveness checker emits duplicate
 warnings. E.g. for `f`:
 {{{#!hs
 f :: Bool -> Bool -> ()
 f (not -> True) (not -> False) = ()
 }}}
 we get:
 {{{
 DuplicateWarn.hs:6:1: warning:
     Pattern match(es) are non-exhaustive
     In an equation for ‘f’:
         Patterns not matched:
             _ _     -- represents (not -> False) _
             _ _     -- represents (not -> True)  (not -> True)
 }}}
 As indicated in the comments, the two comments represent different
 missing cases, but since we do not print the additional information,
 they look alike. It would be better to either:
   * Give additional information to the user to distinguish between the two
 or
   * Print a single warning `(_ _)`

 I cannot think of a nice solution to this yet but I will keep thinking
 about it.

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


More information about the ghc-tickets mailing list