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

GHC ghc-devs at haskell.org
Tue May 8 14:51:24 UTC 2018


#14547: Wrong warning by -Wincomplete-patterns
-------------------------------------+-------------------------------------
        Reporter:  YoshikuniJujo     |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  low               |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.1
      Resolution:  fixed             |             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:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"981bf4718de7daef7817a363ccc14030c2688632/ghc" 981bf47/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="981bf4718de7daef7817a363ccc14030c2688632"
 Normalize the element type of ListPat, fix #14547

 The element type of `List` maybe a type family instacen, rather than a
 trivial type.
 For example in Trac #14547,

 ```
 {-# LANGUAGE TypeFamilies, OverloadedLists #-}

 class Foo f where
         type It f
         foo :: [It f] -> f

 data List a = Empty | a :! List a deriving Show

 instance Foo (List a) where
         type It (List a) = a
         foo [] = Empty
         foo (x : xs) = x :! foo xs
 ```

 Here the element type of `[]` is `It (List a)`, we should also normalize
 it as `a`.

 Test Plan: make test TEST="T14547"

 Reviewers: bgamari

 Reviewed By: bgamari

 Subscribers: thomie, carter

 GHC Trac Issues: #14547

 Differential Revision: https://phabricator.haskell.org/D4624
 }}}

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


More information about the ghc-tickets mailing list