[GHC] #5762: GHC gives incorrect warnings with simple applications of the view patterns extension

GHC ghc-devs at haskell.org
Wed Sep 18 23:13:22 CEST 2013


#5762: GHC gives incorrect warnings with simple applications of the view patterns
extension
-------------------------------------------------+-------------------------
        Reporter:  jmg                           |            Owner:
            Type:  bug                           |           Status:  new
        Priority:  normal                        |        Milestone:  _|_
       Component:  Compiler                      |          Version:  7.3
      Resolution:                                |         Keywords:
Operating System:  Unknown/Multiple              |     Architecture:
 Type of failure:  Incorrect warning at          |  Unknown/Multiple
  compile-time                                   |       Difficulty:
       Test Case:                                |  Unknown
        Blocking:                                |       Blocked By:
                                                 |  Related Tickets:
-------------------------------------------------+-------------------------

Comment (by hvr):

 !PatternGuards can result in a similar spurious warning, i.e.

 {{{#!hs
 module Foo where

 foo :: Either t t -> t
 foo x | Left  l <- x = l
       | Right r <- x = r

 bar :: Either t t -> t
 bar x = v
   where
     v | Left l <- x = l
       | Right r <- x = r
 }}}

 leads to

 {{{
 Foo.hs:4:1: Warning:
     Pattern match(es) are non-exhaustive
     In an equation for `foo': Patterns not matched: _

 Foo.hs:10:5: Warning:
     Pattern match(es) are non-exhaustive
     In an equation for `v': Patterns not matched:
 }}}

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



More information about the ghc-tickets mailing list