Commit 35d2c756 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Fix some tests following the removal of Num's superclasses

parent 6a58730c
......@@ -98,7 +98,7 @@ float_numbers =
-------------
denorm :: RealFloat a => [a] -> String
denorm :: (Show a, RealFloat a) => [a] -> String
denorm numbers =
unlines
( ""
......@@ -109,7 +109,7 @@ denorm numbers =
where
showPerform = showAndPerform (isDenormalized) "isDenormalised"
pos_inf :: RealFloat a => [a] -> String
pos_inf :: (Show a, RealFloat a) => [a] -> String
pos_inf numbers =
unlines
( ""
......@@ -120,7 +120,7 @@ pos_inf numbers =
where
showPerform = showAndPerform (isInfinite) "isInfinite"
neg_inf :: RealFloat a => [a] -> String
neg_inf :: (Show a, RealFloat a) => [a] -> String
neg_inf numbers =
unlines
( ""
......@@ -131,7 +131,7 @@ neg_inf numbers =
where
showPerform = showAndPerform (\ x -> isInfinite x && x < 0) "isNegInfinite"
nan :: RealFloat a => [a] -> String
nan :: (Show a, RealFloat a) => [a] -> String
nan numbers =
unlines
( ""
......@@ -142,7 +142,7 @@ nan numbers =
where
showPerform = showAndPerform (isNaN) "isNaN"
pos_zero :: RealFloat a => [a] -> String
pos_zero :: (Show a, RealFloat a) => [a] -> String
pos_zero numbers =
unlines
( ""
......@@ -153,7 +153,7 @@ pos_zero numbers =
where
showPerform = showAndPerform (==0) "isPosZero"
neg_zero :: RealFloat a => [a] -> String
neg_zero :: (Show a, RealFloat a) => [a] -> String
neg_zero numbers =
unlines
( ""
......
......@@ -53,7 +53,7 @@ test_popCnt64 = test popcnt64 (slowPopcnt . fromIntegral . (mask 64 .&.))
mask n = (2 ^ n) - 1
test :: Num a => (a -> Word) -> (a -> Word) -> String
test :: (Show a, Num a) => (a -> Word) -> (a -> Word) -> String
test fast slow = case failing of
[] -> "OK"
((_, e, a, i):xs) ->
......
class (Eq a, Show a) => Num a where
class Num a where
(+) :: a -> a -> a
...
-- Defined in `GHC.Num'
infixl 6 +
class (Eq a, Show a) => Num a where
class Num a where
(+) :: a -> a -> a
...
-- Defined in `GHC.Num'
......
......@@ -10,7 +10,7 @@ main
showit (do_ops integer_ops)
)
showit :: Integral a => [(String, a, a, a)] -> String
showit :: (Show a, Integral a) => [(String, a, a, a)] -> String
showit stuff = concat
[ str ++ " " ++ show l ++ " " ++ show r ++ " = " ++ show result ++ "\n"
| (str, l, r, result) <- stuff
......
......@@ -22,7 +22,7 @@ test = do
testIntlike "Word64" (0::Word64)
testInteger
testIntlike :: (Bounded a, Integral a, Ix a, Read a, Bits a) => String -> a -> IO ()
testIntlike :: (Bounded a, Integral a, Ix a, Show a, Read a, Bits a) => String -> a -> IO ()
testIntlike name zero = do
putStrLn $ "--------------------------------"
putStrLn $ "--Testing " ++ name
......
......@@ -9,5 +9,5 @@ main = do
test gcdInteger [-12193263111263526900, -42, 0, 105, 1234567890 ]
test :: Integral a => (a -> a -> a) -> [a] -> IO ()
test :: (Show a, Integral a) => (a -> a -> a) -> [a] -> IO ()
test f xs = mapM_ print [ (a, b, f a b) | a <- xs, b <- reverse xs, a /= 0 || b /= 0 ]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment