#1482: unsafeCoerce# doesn't always fully coerce
--------------------------------------+-------------------------------------
  Reporter:  [EMAIL PROTECTED]         |          Owner:               
      Type:  bug                      |         Status:  new          
  Priority:  normal                   |      Milestone:               
 Component:  Compiler (Type checker)  |        Version:  6.6.1        
  Severity:  normal                   |       Keywords:  unsafeCoerce#
Difficulty:  Unknown                  |             Os:  Linux        
  Testcase:                           |   Architecture:  x86          
--------------------------------------+-------------------------------------
{{{
 {-# 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
 }}}

-- 
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

Reply via email to