[GHC] #13651: Invalid redundant pattern matches with -XTypeFamilyDependencies

GHC ghc-devs at haskell.org
Fri May 5 18:04:29 UTC 2017


#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies
-------------------------------------+-------------------------------------
           Reporter:  crockeea       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
  InjectiveFamilies                  |
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The following code triggers a warning about a redundant pattern match for
 `foo`:

 {{{
 {-# LANGUAGE TypeFamilies, TypeFamilyDependencies #-}

 type family F r s = f | f -> r s

 type instance F (Bar h (Foo r)) (Bar h (Foo s)) = Bar h (Bar r s)

 data Bar s b
 data Foo a

 foo :: (F cr cu ~ Bar h (Bar r u),
         F cu cs ~ Bar (Foo h) (Bar u s))
     => Bar h (Bar r u) -> Bar (Foo h) (Bar u s) -> Foo (cr -> cs)
 foo = undefined
 }}}


 {{{
 warning: [-Woverlapping-patterns]
     Pattern match is redundant
     In an equation for ‘foo’: foo = ..
 }}}

 This warning seems invalid to me: I'm not sure how a single definition
 could constitute a redundant pattern match. Moreover, if I try to address
 the warning by removing the "redundant" pattern, the code (of course)
 fails to compile because there is no accompanying binding for the
 signature of `foo`.

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


More information about the ghc-tickets mailing list