[GHC] #8548: Coercible does not resolve type family application

GHC ghc-devs at haskell.org
Thu Nov 21 09:27:07 UTC 2013


#8548: Coercible does not resolve type family application
-------------------------------------------+-------------------------------
       Reporter:  nomeata                  |             Owner:  nomeata
           Type:  bug                      |            Status:  new
       Priority:  normal                   |         Milestone:
      Component:  Compiler (Type checker)  |           Version:  7.6.3
       Keywords:                           |  Operating System:
   Architecture:  Unknown/Multiple         |  Unknown/Multiple
     Difficulty:  Unknown                  |   Type of failure:
     Blocked By:                           |  None/Unknown
Related Tickets:  #8503                    |         Test Case:
                                           |          Blocking:
-------------------------------------------+-------------------------------
 With GND implemented using `Coercible` (See #8503) the test for #4185
 fails. A minimal example is:

 {{{
 {-# LANGUAGE TypeFamilies #-}
 module CoerceNewtypeFamily where
 import GHC.Exts
 data family Foo k
 newtype instance Foo Int = FooInt Int
 x :: Foo Int -> Int
 x = coerce
 }}}

 yielding

 {{{
 [1 of 1] Compiling CoerceNewtypeFamily ( CoerceNewtypeFamily.hs,
 CoerceNewtypeFamily.o )

 CoerceNewtypeFamily.hs:11:5:
     No instance for (Coercible (Foo Int) Int)
       because ‛Foo Int’ and ‛Int’ are different types.
       arising from a use of ‛coerce’
     In the expression: coerce
     In an equation for ‛x’: x = coerce
 }}}

 I guess the `Coercible` finding code needs to simply type family equations
 if possible.

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


More information about the ghc-tickets mailing list