diff options
author | Ian Lynagh <igloo@earth.li> | 2011-09-15 22:03:19 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-10-12 16:28:04 +0100 |
commit | 0a40540e79223f38ee851c66eb377db9a1756e4b (patch) | |
tree | fd0b3bd174e44cfeb48730b4bfa4a88c7d18fcfc /libraries | |
parent | 817c4e19a4248b80f0af764d12721b1284b39e5a (diff) | |
download | haskell-0a40540e79223f38ee851c66eb377db9a1756e4b.tar.gz |
Remove the Eq superclass of Num
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Data/Bits.hs | 2 | ||||
-rw-r--r-- | libraries/base/Foreign/C/Error.hs | 18 | ||||
-rw-r--r-- | libraries/base/Foreign/Marshal/Utils.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Event/Internal.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Num.lhs | 2 | ||||
-rw-r--r-- | libraries/base/Numeric.hs | 6 | ||||
-rw-r--r-- | libraries/base/Text/Read/Lex.hs | 6 |
7 files changed, 20 insertions, 18 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs index 855436d36c..22a6e41a58 100644 --- a/libraries/base/Data/Bits.hs +++ b/libraries/base/Data/Bits.hs @@ -73,7 +73,7 @@ Minimal complete definition: '.&.', '.|.', 'xor', 'complement', ('shift' or ('shiftL' and 'shiftR')), ('rotate' or ('rotateL' and 'rotateR')), 'bitSize' and 'isSigned'. -} -class Num a => Bits a where +class (Eq a, Num a) => Bits a where -- | Bitwise \"and\" (.&.) :: a -> a -> a diff --git a/libraries/base/Foreign/C/Error.hs b/libraries/base/Foreign/C/Error.hs index 6d3ef80842..76ebe272ce 100644 --- a/libraries/base/Foreign/C/Error.hs +++ b/libraries/base/Foreign/C/Error.hs @@ -401,34 +401,36 @@ throwErrnoIfRetryMayBlock_ pred loc f on_block -- | Throw an 'IOError' corresponding to the current value of 'getErrno' -- if the 'IO' action returns a result of @-1@. -- -throwErrnoIfMinus1 :: Num a => String -> IO a -> IO a +throwErrnoIfMinus1 :: (Eq a, Num a) => String -> IO a -> IO a throwErrnoIfMinus1 = throwErrnoIf (== -1) -- | as 'throwErrnoIfMinus1', but discards the result. -- -throwErrnoIfMinus1_ :: Num a => String -> IO a -> IO () +throwErrnoIfMinus1_ :: (Eq a, Num a) => String -> IO a -> IO () throwErrnoIfMinus1_ = throwErrnoIf_ (== -1) -- | Throw an 'IOError' corresponding to the current value of 'getErrno' -- if the 'IO' action returns a result of @-1@, but retries in case of -- an interrupted operation. -- -throwErrnoIfMinus1Retry :: Num a => String -> IO a -> IO a +throwErrnoIfMinus1Retry :: (Eq a, Num a) => String -> IO a -> IO a throwErrnoIfMinus1Retry = throwErrnoIfRetry (== -1) -- | as 'throwErrnoIfMinus1', but discards the result. -- -throwErrnoIfMinus1Retry_ :: Num a => String -> IO a -> IO () +throwErrnoIfMinus1Retry_ :: (Eq a, Num a) => String -> IO a -> IO () throwErrnoIfMinus1Retry_ = throwErrnoIfRetry_ (== -1) -- | as 'throwErrnoIfMinus1Retry', but checks for operations that would block. -- -throwErrnoIfMinus1RetryMayBlock :: Num a => String -> IO a -> IO b -> IO a +throwErrnoIfMinus1RetryMayBlock :: (Eq a, Num a) + => String -> IO a -> IO b -> IO a throwErrnoIfMinus1RetryMayBlock = throwErrnoIfRetryMayBlock (== -1) -- | as 'throwErrnoIfMinus1RetryMayBlock', but discards the result. -- -throwErrnoIfMinus1RetryMayBlock_ :: Num a => String -> IO a -> IO b -> IO () +throwErrnoIfMinus1RetryMayBlock_ :: (Eq a, Num a) + => String -> IO a -> IO b -> IO () throwErrnoIfMinus1RetryMayBlock_ = throwErrnoIfRetryMayBlock_ (== -1) -- | Throw an 'IOError' corresponding to the current value of 'getErrno' @@ -481,13 +483,13 @@ throwErrnoPathIfNull = throwErrnoPathIf (== nullPtr) -- | as 'throwErrnoIfMinus1', but exceptions include the given path when -- appropriate. -- -throwErrnoPathIfMinus1 :: Num a => String -> FilePath -> IO a -> IO a +throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> FilePath -> IO a -> IO a throwErrnoPathIfMinus1 = throwErrnoPathIf (== -1) -- | as 'throwErrnoIfMinus1_', but exceptions include the given path when -- appropriate. -- -throwErrnoPathIfMinus1_ :: Num a => String -> FilePath -> IO a -> IO () +throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> FilePath -> IO a -> IO () throwErrnoPathIfMinus1_ = throwErrnoPathIf_ (== -1) -- conversion of an "errno" value into IO error diff --git a/libraries/base/Foreign/Marshal/Utils.hs b/libraries/base/Foreign/Marshal/Utils.hs index d3ab1fd057..ba8afccc32 100644 --- a/libraries/base/Foreign/Marshal/Utils.hs +++ b/libraries/base/Foreign/Marshal/Utils.hs @@ -108,7 +108,7 @@ fromBool True = 1 -- |Convert a Boolean in numeric representation to a Haskell value -- -toBool :: Num a => a -> Bool +toBool :: (Eq a, Num a) => a -> Bool toBool = (/= 0) diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs index b5d7c0ff41..00209fcf55 100644 --- a/libraries/base/GHC/Event/Internal.hs +++ b/libraries/base/GHC/Event/Internal.hs @@ -129,7 +129,7 @@ delete (Backend bState _ _ bDelete) = bDelete bState -- 'getErrno' is not 'eINTR'. If the result value is -1 and -- 'getErrno' returns 'eINTR' 0 is returned. Otherwise the result -- value is returned. -throwErrnoIfMinus1NoRetry :: Num a => String -> IO a -> IO a +throwErrnoIfMinus1NoRetry :: (Eq a, Num a) => String -> IO a -> IO a throwErrnoIfMinus1NoRetry loc f = do res <- f if res == -1 diff --git a/libraries/base/GHC/Num.lhs b/libraries/base/GHC/Num.lhs index 9a1a38f7c8..a9d0fa26e4 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) => Num a where +class Num a where (+), (-), (*) :: a -> a -> a -- | Unary negation. negate :: a -> a diff --git a/libraries/base/Numeric.hs b/libraries/base/Numeric.hs index edaeb022b3..167aa7b1b7 100644 --- a/libraries/base/Numeric.hs +++ b/libraries/base/Numeric.hs @@ -90,16 +90,16 @@ readInt :: Num a readInt base isDigit valDigit = readP_to_S (L.readIntP base isDigit valDigit) -- | Read an unsigned number in octal notation. -readOct :: Num a => ReadS a +readOct :: (Eq a, Num a) => ReadS a readOct = readP_to_S L.readOctP -- | Read an unsigned number in decimal notation. -readDec :: Num a => ReadS a +readDec :: (Eq a, Num a) => ReadS a readDec = readP_to_S L.readDecP -- | Read an unsigned number in hexadecimal notation. -- Both upper or lower case letters are allowed. -readHex :: Num a => ReadS a +readHex :: (Eq a, Num a) => ReadS a readHex = readP_to_S L.readHexP -- | Reads an /unsigned/ 'RealFrac' value, diff --git a/libraries/base/Text/Read/Lex.hs b/libraries/base/Text/Read/Lex.hs index 310c7152eb..199aa9b173 100644 --- a/libraries/base/Text/Read/Lex.hs +++ b/libraries/base/Text/Read/Lex.hs @@ -413,7 +413,7 @@ fracExp exp mant (d:ds) = exp' `seq` mant' `seq` fracExp exp' mant' ds exp' = exp - 1 mant' = mant * 10 + fromIntegral d -valDig :: Num a => a -> Char -> Maybe Int +valDig :: (Eq a, Num a) => a -> Char -> Maybe Int valDig 8 c | '0' <= c && c <= '7' = Just (ord c - ord '0') | otherwise = Nothing @@ -441,13 +441,13 @@ readIntP base isDigit valDigit = do s <- munch1 isDigit return (val base 0 (map valDigit s)) -readIntP' :: Num a => a -> ReadP a +readIntP' :: (Eq a, Num a) => a -> ReadP a readIntP' base = readIntP base isDigit valDigit where isDigit c = maybe False (const True) (valDig base c) valDigit c = maybe 0 id (valDig base c) -readOctP, readDecP, readHexP :: Num a => ReadP a +readOctP, readDecP, readHexP :: (Eq a, Num a) => ReadP a readOctP = readIntP' 8 readDecP = readIntP' 10 readHexP = readIntP' 16 |