[add some numeric conversion rules for fromIntegral, simplify some numeric casts in the FFI
John Meacham <john@repetae.net>**20060428072833] hunk ./lib/base/Foreign/C/String.hs 187
-castCCharToChar :: CChar -> Char
-castCCharToChar ch = chr (fromIntegral (fromIntegral ch :: Word8))
+--castCCharToChar :: CChar -> Char
+--castCCharToChar ch = chr (fromIntegral (fromIntegral ch :: Word8))
hunk ./lib/base/Foreign/C/String.hs 192
-castCharToCChar :: Char -> CChar
-castCharToCChar ch = fromIntegral (ord ch)
+--castCharToCChar :: Char -> CChar
+--castCharToCChar ch = fromIntegral (ord ch)
+
+foreign import primitive "integralCast" castCCharToChar :: CChar -> Char
+foreign import primitive "integralCast" castCharToCChar :: Char -> CChar
hunk ./lib/base/Foreign/C/String.hs 445
-castCWcharToChar :: CWchar -> Char
-castCWcharToChar ch = chr (fromIntegral ch )
+--castCWcharToChar :: CWchar -> Char
+--castCWcharToChar ch = chr (fromIntegral ch )
+
+--castCharToCWchar :: Char -> CWchar
+--castCharToCWchar ch = fromIntegral (ord ch)
+
+foreign import primitive "integralCast" castCWcharToChar :: CWchar -> Char
+foreign import primitive "integralCast" castCharToCWchar :: Char -> CWchar
+
hunk ./lib/base/Foreign/C/String.hs 455
-castCharToCWchar :: Char -> CWchar
-castCharToCWchar ch = fromIntegral (ord ch)
hunk ./lib/base/Prelude.hs 301
-{-# INLINE fromIntegral, realToFrac #-}
hunk ./lib/base/Prelude.hs 304
+{-# RULES
+  "fromIntegral/Int"          fromIntegral = (id :: Int -> Int)
+  "fromIntegral/Integer"      fromIntegral = (id :: Integer -> Integer)
+  "fromIntegral/toInt"        fromIntegral = toInt
+  "fromIntegral/fromInt"      fromIntegral = fromInt
+  "fromIntegral/toInteger"    fromIntegral = toInteger
+  "fromIntegral/fromInteger"  fromIntegral = fromInteger
+ #-}
+