[GHC] #14247: Fails to coerce between newtypes directly

GHC ghc-devs at haskell.org
Mon Sep 18 22:21:21 UTC 2017


#14247: Fails to coerce between newtypes directly
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 import Data.Coerce
 import Data.Type.Coercion

 newtype W a = W a
 newtype A   = MkA (W A)

 a :: Coercion A A
 a = Coercion

 b :: Coercion a a' -> Coercion a (W a')
 b Coercion = Coercion

 c :: Coercion A (W A)
 c = b a
 }}}

 works just fine but the following fail:

 {{{#!hs
 -- • Couldn't match representation of type ‘A’ with that of ‘W A’
 --     arising from a use of ‘Coercion’
 -- • In the expression: Coercion
 --   In an equation for ‘d’: d = Coercion
 d :: Coercion A (W A)
 d = Coercion

 -- • Couldn't match representation of type ‘A’ with that of ‘W A’
 --     arising from a use of ‘coerce’
 -- • In the expression: coerce
 --   In an equation for ‘e’: e = coerce
 e :: A -> W A
 e = coerce
 }}}

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


More information about the ghc-tickets mailing list