+
+-- We can use rewrite rules for the RealFrac methods
+
+{-# RULES
+"properFraction/Float->(Word32,Float)"
+ forall x. properFraction (x :: Float) =
+ case properFraction x of {
+ (n, y) -> ((fromIntegral :: Int -> Word32) n, y) }
+"truncate/Float->Word32"
+ forall x. truncate (x :: Float) = (fromIntegral :: Int -> Word32) (truncate x)
+"floor/Float->Word32"
+ forall x. floor (x :: Float) = (fromIntegral :: Int -> Word32) (floor x)
+"ceiling/Float->Word32"
+ forall x. ceiling (x :: Float) = (fromIntegral :: Int -> Word32) (ceiling x)
+"round/Float->Word32"
+ forall x. round (x :: Float) = (fromIntegral :: Int -> Word32) (round x)
+ #-}
+
+{-# RULES
+"properFraction/Double->(Word32,Double)"
+ forall x. properFraction (x :: Double) =
+ case properFraction x of {
+ (n, y) -> ((fromIntegral :: Int -> Word32) n, y) }
+"truncate/Double->Word32"
+ forall x. truncate (x :: Double) = (fromIntegral :: Int -> Word32) (truncate x)
+"floor/Double->Word32"
+ forall x. floor (x :: Double) = (fromIntegral :: Int -> Word32) (floor x)
+"ceiling/Double->Word32"
+ forall x. ceiling (x :: Double) = (fromIntegral :: Int -> Word32) (ceiling x)
+"round/Double->Word32"
+ forall x. round (x :: Double) = (fromIntegral :: Int -> Word32) (round x)
+ #-}
+