[GHC] #11700: pattern match bug

GHC ghc-devs at haskell.org
Sun May 8 00:12:19 UTC 2016


#11700: pattern match bug
-------------------------------------+-------------------------------------
        Reporter:  TobyGoodwin       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  https://github.com/TobyGoodwin/odd-
                                     |  ghc-pattern-bug
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by thomie):

 Here is a reproducer:

 {{{#!hs
 {-# LANGUAGE ExistentialQuantification #-}
 {-# LANGUAGE TypeFamilies #-} -- Remove this line and the code compiles.

 module T11700 where

 data Muse
 data Message
 data Folder

 class PersistEntity record

 data Entity record = PersistEntity record => Entity record

 fn1 :: (Entity Muse, Entity Message, Entity Folder) -> (Message, Folder)
 fn1 cluster =
   let (Entity muse, Entity msg, Entity fldr) = cluster
   in (msg, fldr)
 }}}

 {{{
 [1 of 1] Compiling T11700           ( T11700.hs, /tmp/T11700.o )

 T11700.hs:17:12: error:
     • Couldn't match expected type ‘Folder’ with actual type ‘Folder’
     • In the expression: fldr
       In the expression: (msg, fldr)
       In the expression:
         let (Entity muse, Entity msg, Entity fldr) = cluster in (msg,
 fldr)

 T11700.hs:17:7: error:
     • Couldn't match expected type ‘Message’ with actual type ‘Message’
     • In the expression: msg
       In the expression: (msg, fldr)
       In the expression:
         let (Entity muse, Entity msg, Entity fldr) = cluster in (msg,
 fldr)
 }}}

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


More information about the ghc-tickets mailing list