diff options
author | Ian Lynagh <igloo@earth.li> | 2011-09-15 20:42:22 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-10-12 16:14:03 +0100 |
commit | 817c4e19a4248b80f0af764d12721b1284b39e5a (patch) | |
tree | 1775caa9a421ec4d1183118f4ea80d40d0832dd8 /libraries | |
parent | 4d4740420a9406062f8526b6088f00c7207cd9bd (diff) | |
download | haskell-817c4e19a4248b80f0af764d12721b1284b39e5a.tar.gz |
Remove the Show superclass of Num
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Data/Data.hs | 4 | ||||
-rw-r--r-- | libraries/base/GHC/Num.lhs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Real.lhs | 2 | ||||
-rw-r--r-- | libraries/base/Numeric.hs | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index d04f37cbdb..5de1eaff41 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -767,7 +767,7 @@ mkPrimCon dt str cr = Constr mkIntConstr :: DataType -> Integer -> Constr mkIntConstr = mkIntegralConstr -mkIntegralConstr :: (Integral a) => DataType -> a -> Constr +mkIntegralConstr :: (Integral a, Show a) => DataType -> a -> Constr mkIntegralConstr dt i = case datarep dt of IntRep -> mkPrimCon dt (show i) (IntConstr (toInteger i)) _ -> error "Data.Data.mkIntegralConstr" @@ -777,7 +777,7 @@ mkIntegralConstr dt i = case datarep dt of mkFloatConstr :: DataType -> Double -> Constr mkFloatConstr dt = mkRealConstr dt . toRational -mkRealConstr :: (Real a) => DataType -> a -> Constr +mkRealConstr :: (Real a, Show a) => DataType -> a -> Constr mkRealConstr dt f = case datarep dt of FloatRep -> mkPrimCon dt (show f) (FloatConstr (toRational f)) _ -> error "Data.Data.mkRealConstr" diff --git a/libraries/base/GHC/Num.lhs b/libraries/base/GHC/Num.lhs index 148bdfa199..9a1a38f7c8 100644 --- a/libraries/base/GHC/Num.lhs +++ b/libraries/base/GHC/Num.lhs @@ -57,7 +57,7 @@ default () -- Double isn't available yet, -- | Basic numeric class. -- -- Minimal complete definition: all except 'negate' or @(-)@ -class (Eq a, Show a) => Num a where +class (Eq a) => Num a where (+), (-), (*) :: a -> a -> a -- | Unary negation. negate :: a -> a diff --git a/libraries/base/GHC/Real.lhs b/libraries/base/GHC/Real.lhs index 4bc1d09be9..49f8487087 100644 --- a/libraries/base/GHC/Real.lhs +++ b/libraries/base/GHC/Real.lhs @@ -362,7 +362,7 @@ instance (Integral a) => RealFrac (Ratio a) where properFraction (x:%y) = (fromInteger (toInteger q), r:%y) where (q,r) = quotRem x y -instance (Integral a) => Show (Ratio a) where +instance (Integral a, Show a) => Show (Ratio a) where {-# SPECIALIZE instance Show Rational #-} showsPrec p (x:%y) = showParen (p > ratioPrec) $ showsPrec ratioPrec1 x . diff --git a/libraries/base/Numeric.hs b/libraries/base/Numeric.hs index 8989f967a2..edaeb022b3 100644 --- a/libraries/base/Numeric.hs +++ b/libraries/base/Numeric.hs @@ -198,7 +198,7 @@ showGFloat d x = showString (formatRealFloat FFGeneric d x) -- | Shows a /non-negative/ 'Integral' number using the base specified by the -- first argument, and the character representation specified by the second. -showIntAtBase :: Integral a => a -> (Int -> Char) -> a -> ShowS +showIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> ShowS showIntAtBase base toChr n0 r0 | base <= 1 = error ("Numeric.showIntAtBase: applied to unsupported base " ++ show base) | n0 < 0 = error ("Numeric.showIntAtBase: applied to negative number " ++ show n0) @@ -213,9 +213,9 @@ showIntAtBase base toChr n0 r0 r' = c : r -- | Show /non-negative/ 'Integral' numbers in base 16. -showHex :: Integral a => a -> ShowS +showHex :: (Integral a,Show a) => a -> ShowS showHex = showIntAtBase 16 intToDigit -- | Show /non-negative/ 'Integral' numbers in base 8. -showOct :: Integral a => a -> ShowS +showOct :: (Integral a, Show a) => a -> ShowS showOct = showIntAtBase 8 intToDigit |