arith013.hs 389 Bytes
Newer Older
1
2
-- Test gcdInt/gcdInteger

3
import GHC.Real	( gcdInt )
4
import GHC.Num	( gcdInteger )
5
6
7
8
9
10
11
12
13

main :: IO ()
main = do
   test gcdInt     [                       -42, 0, 105             ]
   test gcdInteger [-12193263111263526900, -42, 0, 105, 1234567890 ]


test :: 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 ]