Fails to coerce between newtypes directly
import Data.Coerce
import Data.Type.Coercion
newtype W a = W a
newtype A = MkA (W A)
a :: Coercion A A
a = Coercion
b :: Coercion a a' -> Coercion a (W a')
b Coercion = Coercion
c :: Coercion A (W A)
c = b a
works just fine but the following fail:
-- • Couldn't match representation of type ‘A’ with that of ‘W A’
-- arising from a use of ‘Coercion’
-- • In the expression: Coercion
-- In an equation for ‘d’: d = Coercion
d :: Coercion A (W A)
d = Coercion
-- • Couldn't match representation of type ‘A’ with that of ‘W A’
-- arising from a use of ‘coerce’
-- • In the expression: coerce
-- In an equation for ‘e’: e = coerce
e :: A -> W A
e = coerce
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |