Skip to content

coerce fails for Coercible type families

I want to bring attention to this reddit post that boils down to

type family   X a
type instance X Int  = String
type instance X Bool = String

data T a = T (X a)

but not being able to coerce

coerce :: T Int -> T Bool

This gives the error “Couldn't match type ‘Int’ with ‘Bool’ arising from a use of ‘coerce’”.

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