[project @ 2002-04-11 12:03:43 by simonpj]
[ghc-base.git] / GHC / Real.lhs
index b453f6b..98edd2e 100644 (file)
@@ -1,5 +1,5 @@
 % ------------------------------------------------------------------------------
-% $Id: Real.lhs,v 1.1 2001/06/28 14:15:03 simonmar Exp $
+% $Id: Real.lhs,v 1.3 2002/02/12 15:51:26 simonmar Exp $
 %
 % (c) The University of Glasgow, 1994-2000
 %
@@ -62,6 +62,7 @@ their greatest common divisor.
 
 \begin{code}
 reduce ::  (Integral a) => a -> a -> Ratio a
+{-# SPECIALISE reduce :: Integer -> Integer -> Rational #-}
 reduce _ 0             =  error "Ratio.%: zero denominator"
 reduce x y             =  (x `quot` d) :% (y `quot` d)
                           where d = gcd x y
@@ -226,7 +227,7 @@ instance  (Integral a)      => Num (Ratio a)  where
 instance  (Integral a) => Fractional (Ratio a)  where
     {-# SPECIALIZE instance Fractional Rational #-}
     (x:%y) / (x':%y')  =  (x*y') % (y*x')
-    recip (x:%y)       =  if x < 0 then (-y) :% (-x) else y :% x
+    recip (x:%y)       =  y % x
     fromRational (x:%y) =  fromInteger x :% fromInteger y
 
 instance  (Integral a) => Real (Ratio a)  where
@@ -281,16 +282,6 @@ realToFrac = fromRational . toRational
 {-# RULES
 "realToFrac/Int->Int" realToFrac = id :: Int -> Int
     #-}
-
--- For backward compatibility
-{-# DEPRECATED fromInt "use fromIntegral instead" #-}
-fromInt :: Num a => Int -> a
-fromInt = fromIntegral
-
--- For backward compatibility
-{-# DEPRECATED toInt "use fromIntegral instead" #-}
-toInt :: Integral a => a -> Int
-toInt = fromIntegral
 \end{code}
 
 %*********************************************************