Skip to content

'impossible' happened in reportNoInstance?

This program, though it shouldn't typecheck, shouldn't make the compiler panic like this either:

ghc-6.5: panic! (the 'impossible' happened)
  (GHC version 6.5 for i386-unknown-linux):
        reportNoInstance
    $dPrintfType{v alY} :: {<pred>base:Text.Printf.PrintfType{tc r5j} (a{tv alO} [sk]
                                                                       -> b{tv alP} [sk])}

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Presumably the problem is in the phex part...

{-# OPTIONS_GHC -fglasgow-exts #-}
#!haskell

-- Actually, this exercises prelude/PrelRules, but this is the closest
-- place I could find to put it...

import GHC.Exts
import Numeric
import Text.Printf

main = do phex (I# (uncheckedIShiftL#  (negateInt# 5#) 2#))
          phex (I# (uncheckedIShiftRA# (negateInt# 5#) 1#))
          phex (I# (uncheckedIShiftRL# (negateInt# 5#) 1#))
          phex (W# (uncheckedShiftL#   (int2Word# (negateInt# 5#)) 2#))
          phex (W# (uncheckedShiftRL#  (int2Word# (negateInt# 5#)) 1#))

-- this doesn't work on negative numbers :-(
-- phex x = putStrLn ("0x" ++ showHex x "") 

phex :: a -> b
phex x = printf "0x%x" x
Trac metadata
Trac field Value
Version 6.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information