#5015: Can't unsafeCoerce a GADT with a coercion
---------------------------------+------------------------------------------
Reporter: TristanAllwood | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (Type checker)
Version: 7.0.2 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
{{{
type family Blah a
type instance Blah Int = Int
data E where
E :: (Blah a ~ Int) => a -> E
}}}
{{{
*Example Unsafe.Coerce GHC.Prim> (unsafeCoerce E) :: Any
<interactive>:1:15:
Couldn't match type `Blah a0' with `Int'
In the first argument of `unsafeCoerce', namely `E'
In the expression: (unsafeCoerce E) :: Any
In an equation for `it': it = (unsafeCoerce E) :: Any
}}}
This also doesn't work with less dangerous operators, like seq:
{{{
*Example Unsafe.Coerce GHC.Prim> (id E) `seq` ()
<interactive>:1:5:
Couldn't match type `Blah a0' with `Int'
In the first argument of `id', namely `E'
In the first argument of `seq', namely `(id E)'
In the expression: (id E) `seq` ()
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5015>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs