[GHC] #15441: Data type with phantoms using TypeInType isn't coercible

GHC ghc-devs at haskell.org
Thu Jul 26 16:03:42 UTC 2018


#15441: Data type with phantoms using TypeInType isn't coercible
-------------------------------------+-------------------------------------
        Reporter:  glittershark      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by glittershark):

 As a follow-up with further information, the code where I'm actually using
 this has Foo as a GADT, where the constructor I'm coercing has its
 parameter phantom, like so:

 {{{#!hs
 {-# LANGUAGE GADTs, TypeInType, TypeApplications #-}
 module Coerce where

 import Prelude
 import Data.Coerce
 import Data.Kind

 data Foo (a :: Type) where
   A :: Foo a
   C :: Foo Int

 data Bar (a :: Type) (b :: Foo a) where
   Bar :: Bar a 'A

 x = coerce @(Bar Int 'A) @(Bar Bool 'A)
 }}}

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


More information about the ghc-tickets mailing list