Skip to content

type unsafety with type family + GADT

Here's unsafeCoerce:

type family Const a
type instance Const a = ()

data T a where T :: a -> T (Const a)

coerce :: forall a b . a -> b
coerce x = case T x :: T (Const b) of
           T y -> y

Tested with GHC 6.9.20070918

Maybe, see also #345

Trac metadata
Trac field Value
Version 6.8
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information