+
+#ifdef __NHC__
+instance Bits Int where
+ (.&.) = nhc_primIntAnd
+ (.|.) = nhc_primIntOr
+ xor = nhc_primIntXor
+ complement = nhc_primIntCompl
+ shiftL = nhc_primIntLsh
+ shiftR = nhc_primIntRsh
+ bitSize _ = 32
+ isSigned _ = True
+
+foreign import ccall nhc_primIntAnd :: Int -> Int -> Int
+foreign import ccall nhc_primIntOr :: Int -> Int -> Int
+foreign import ccall nhc_primIntXor :: Int -> Int -> Int
+foreign import ccall nhc_primIntLsh :: Int -> Int -> Int
+foreign import ccall nhc_primIntRsh :: Int -> Int -> Int
+foreign import ccall nhc_primIntCompl :: Int -> Int
+
+instance Bits Integer where
+ -- (.&.) a b = undefined
+ -- (.|.) a b = undefined
+ -- xor a b = undefined
+ complement a = (-a)
+ x `shift` i | i<0 = x `div` (2^(-i))
+ | i==0 = x
+ | i>0 = x * (2^i)
+ x `rotate` i = x `shift` i -- an Integer never wraps
+ bitSize _ = error "Data.Bits: bitSize :: Integer -> Int"
+ isSigned _ = True
+
+#endif
+