unsafeCoerce# doesn't always fully coerce
{-# OPTIONS_GHC -fglasgow-exts #-}
import GHC.Prim( unsafeCoerce# )
e1 = unsafeCoerce# (+)
e2 = unsafeCoerce# shows
e1 coerces fine, even with the Num constraint, but e2 does not. The error for e2 is
Ambiguous type variable `a' in the constraint:
`Show a' arising from use of `shows' at T.lhs:7:20-24
Probable fix: add a type signature that fixes these type variable(s)
Weirder still, ghci coerces shows fine:
*Main> :t unsafeCoerce# shows
unsafeCoerce# shows :: forall b. b
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.6.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |