#1482: unsafeCoerce# doesn't always fully coerce
----------------------------------------+-----------------------------------
Reporter: [EMAIL PROTECTED] | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 6.6.1
Severity: normal | Resolution: invalid
Keywords: unsafeCoerce# | Difficulty: Unknown
Os: Linux | Testcase:
Architecture: x86 |
----------------------------------------+-----------------------------------
Changes (by igloo):
* resolution: => invalid
* status: new => closed
Comment:
Defaulting only happens in H98 if you have a Num constraint. If you use
`-fextended-default-rules` then the original example works:
{{{
{-# OPTIONS_GHC -fglasgow-exts -fextended-default-rules #-}
import GHC.Prim( unsafeCoerce# )
e1 = unsafeCoerce# (+)
e2 = unsafeCoerce# shows
}}}
Alternatively (and the preferred option), you can give shows an explicit
type, so no defaulting needs to happen:
{{{
{-# OPTIONS_GHC -fglasgow-exts #-}
import GHC.Prim( unsafeCoerce# )
e1 = unsafeCoerce# (+)
e2 = unsafeCoerce# (shows :: () -> ShowS)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1482>
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