diff options
-rw-r--r-- | libraries/base/Numeric.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/primops/should_run/T16164.hs | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libraries/base/Numeric.hs b/libraries/base/Numeric.hs index 93daae4ec3..fb7aa3f86a 100644 --- a/libraries/base/Numeric.hs +++ b/libraries/base/Numeric.hs @@ -277,10 +277,10 @@ showHFloat = showString . fmt -- | 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, Show a) => a -> (Int -> Char) -> a -> ShowS +showIntAtBase :: Integral a => a -> (Int -> Char) -> a -> ShowS showIntAtBase base toChr n0 r0 - | base <= 1 = errorWithoutStackTrace ("Numeric.showIntAtBase: applied to unsupported base " ++ show base) - | n0 < 0 = errorWithoutStackTrace ("Numeric.showIntAtBase: applied to negative number " ++ show n0) + | base <= 1 = errorWithoutStackTrace ("Numeric.showIntAtBase: applied to unsupported base " ++ show (toInteger base)) + | n0 < 0 = errorWithoutStackTrace ("Numeric.showIntAtBase: applied to negative number " ++ show (toInteger n0)) | otherwise = showIt (quotRem n0 base) r0 where showIt (n,d) r = seq c $ -- stricter than necessary @@ -292,13 +292,13 @@ showIntAtBase base toChr n0 r0 r' = c : r -- | Show /non-negative/ 'Integral' numbers in base 16. -showHex :: (Integral a,Show a) => a -> ShowS +showHex :: Integral a => a -> ShowS showHex = showIntAtBase 16 intToDigit -- | Show /non-negative/ 'Integral' numbers in base 8. -showOct :: (Integral a, Show a) => a -> ShowS +showOct :: Integral a => a -> ShowS showOct = showIntAtBase 8 intToDigit -- | Show /non-negative/ 'Integral' numbers in base 2. -showBin :: (Integral a, Show a) => a -> ShowS +showBin :: Integral a => a -> ShowS showBin = showIntAtBase 2 intToDigit diff --git a/testsuite/tests/primops/should_run/T16164.hs b/testsuite/tests/primops/should_run/T16164.hs index 5ac772bf84..6de6bd9117 100644 --- a/testsuite/tests/primops/should_run/T16164.hs +++ b/testsuite/tests/primops/should_run/T16164.hs @@ -14,7 +14,7 @@ import Numeric (showIntAtBase) -- yields the same word. -- Takes the bit reversion function as an argument so different word types -- can be used with their own functions. -test :: (FiniteBits a, Integral a, Show a) => (a -> a) -> a -> Bool +test :: (FiniteBits a, Integral a) => (a -> a) -> a -> Bool test bitReverter x = let -- These zeroes are to left-pad the base-2 representation of -- @x@ so that the string has one ASCII character per bit in the |