[GHC] #10428: GHC cannot match representations using Coercible constraint

GHC ghc-devs at haskell.org
Mon May 18 03:28:27 UTC 2015


#10428: GHC cannot match representations using Coercible constraint
-------------------------------------+-------------------------------------
              Reporter:  crockeea    |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 The following code compiles in 7.8.4 but fails in 7.10.1:


 {{{#!hs
 import Data.Coerce
 coerceNewtype :: (Coercible (o r) (n m' r)) => [o r] -> [n m' r]
 coerceNewtype = coerce
 }}}

 with the error

 {{{

 Couldn't match representation of type ‘n m' r’ with that of ‘o r’
 arising from trying to show that the representations of
   ‘[o r]’ and
   ‘[n m' r]’ are the same
 Relevant role signatures: type role [] representational
 }}}

 However, the following compiles:


 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}

 import Data.Coerce
 coerceNewtype :: (Coercible a b, a ~ (o r), b ~ (n m' r)) => [o r] -> [n
 m' r]
 coerceNewtype = coerce
 }}}

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


More information about the ghc-tickets mailing list