[GHC] #14547: Wrong warning by -Wincomplete-patterns

GHC ghc-devs at haskell.org
Thu Apr 26 22:23:18 UTC 2018


#14547: Wrong warning by -Wincomplete-patterns
-------------------------------------+-------------------------------------
        Reporter:  YoshikuniJujo     |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  low               |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  incomplete-
                                     |  patterns OverloadedLists,
                                     |  PatternMatchWarnings TypeFamilies
Operating System:  Linux             |         Architecture:  x86
 Type of failure:  Incorrect         |            Test Case:
  error/warning at compile-time      |  deSugar/should_compile/T14547
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4624
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by dfeuer):

 * cc: dfeuer (added)


Comment:

 In Simon's example,

 {{{#!hs
 f (toList -> [])     = e1
 f (toList -> (a:as)) = e2
 }}}

 I don't see how it's at all relevant that `toList` is from an `IsList`
 instance. I imagine we ''always'' want to common up view patterns using
 the same function for coverage checking. For example, given

 {{{#!hs
 f (g -> P1) = e1
 f P2 = e2
 f (g -> P3) = e3
 }}}

 I imagine we want to transform that to something like

 {{{#!hs
 f x
   | P1 <- gx = e1
   | P2 <- x = e2
   | P3 <- gx = e3
   where gx = g x
 }}}

 when performing coverage checks. I don't know how the details work out for
 the pattern checker.

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


More information about the ghc-tickets mailing list