From 5335c6b64fc8c0a7a800310af04cad3dec789065 Mon Sep 17 00:00:00 2001 From: panne Date: Mon, 2 Apr 2001 21:24:44 +0000 Subject: [PATCH] [project @ 2001-04-02 21:24:44 by panne] Don't use deprecated exception functions --- ghc/tests/lib/should_run/exceptions001.hs | 8 ++++---- ghc/tests/lib/should_run/list001.hs | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ghc/tests/lib/should_run/exceptions001.hs b/ghc/tests/lib/should_run/exceptions001.hs index d3c9d15..e585ca5 100644 --- a/ghc/tests/lib/should_run/exceptions001.hs +++ b/ghc/tests/lib/should_run/exceptions001.hs @@ -17,7 +17,7 @@ ioTest = catchJust userErrors (ioError (userError "wibble")) (\ex -> putStr "user exception caught\n") errorTest :: IO () -errorTest = tryAll (1 + error "call to 'error'") >>= \r -> +errorTest = try (evaluate (1 + error "call to 'error'")) >>= \r -> case r of Left exception -> putStr "error call caught\n" Right _ -> error "help!" @@ -25,20 +25,20 @@ errorTest = tryAll (1 + error "call to 'error'") >>= \r -> instance (Show a, Eq a) => Num (Maybe a) where {} noMethodTest :: IO () -noMethodTest = tryAll (Just () + Just ()) >>= \ r -> +noMethodTest = try (evaluate (Just () + Just ())) >>= \ r -> case r of Left (NoMethodError err) -> putStr "no method error\n" Right _ -> error "help!" patMatchTest :: IO () -patMatchTest = catchAllIO (case test1 [1..10] of () -> return ()) +patMatchTest = catch (case test1 [1..10] of () -> return ()) (\ex -> case ex of PatternMatchFail err -> putStr err other -> error "help!") test1 [] = () -guardTest = catchAllIO (case test2 of () -> return ()) +guardTest = catch (case test2 of () -> return ()) (\ex -> case ex of PatternMatchFail err -> putStr err other -> error "help!") diff --git a/ghc/tests/lib/should_run/list001.hs b/ghc/tests/lib/should_run/list001.hs index ca82d35..a1ea650 100644 --- a/ghc/tests/lib/should_run/list001.hs +++ b/ghc/tests/lib/should_run/list001.hs @@ -13,19 +13,19 @@ main = do -- head print (head [1,2,3,4], head "a") - catchAllIO (print (head [] :: String)) (\_ -> putStr "head []\n") + catch (print (head [] :: String)) (\_ -> putStr "head []\n") -- tail print (tail [1,2,3,4], tail "a") - catchAllIO (print (tail [] :: String)) (\_ -> putStr "tail []\n") + catch (print (tail [] :: String)) (\_ -> putStr "tail []\n") -- init print (init [1,2,3,4], init "a") - catchAllIO (print (init [] :: String)) (\_ -> putStr "init []\n") + catch (print (init [] :: String)) (\_ -> putStr "init []\n") -- last print (last [1,2,3,4], last "a") - catchAllIO (print (last [] :: String)) (\_ -> putStr "last []\n") + catch (print (last [] :: String)) (\_ -> putStr "last []\n") -- null print [null [], null "abc"] @@ -38,43 +38,43 @@ main = do -- foldl1 print (foldl1 (+) [1..10]) - catchAllIO (print (foldl1 (+) [] :: Int)) (\_ -> putStr "foldl1 []\n") + catch (print (foldl1 (+) [] :: Int)) (\_ -> putStr "foldl1 []\n") -- scanl print (scanl (+) 1 [1..10]) -- scanl1 print (scanl1 (+) [1..10]) - catchAllIO (print (scanl1 (+) [] :: [Int])) (\_ -> putStr "scanl1 []\n") + catch (print (scanl1 (+) [] :: [Int])) (\_ -> putStr "scanl1 []\n") -- foldr1 print (foldr1 (+) [1..10]) - catchAllIO (print (foldr1 (+) [] :: Int)) (\_ -> putStr "foldr1 []\n") + catch (print (foldr1 (+) [] :: Int)) (\_ -> putStr "foldr1 []\n") -- scanr print (scanr (+) 1 [1..10]) -- scanr1 print (scanr1 (+) [1..10]) - catchAllIO (print (scanr1 (+) [] :: [Int])) (\_ -> putStr "scanr1 []\n") + catch (print (scanr1 (+) [] :: [Int])) (\_ -> putStr "scanr1 []\n") -- iterate print (take 10 (cycle (take 4 (iterate (+1) 1)))) -- take print (take 4 (repeat "x"), take 0 (repeat "x"), take 5 [1..4]) - catchAllIO (print (take (-1) [1..10])) (\_ -> putStr "take (-1)\n") + catch (print (take (-1) [1..10])) (\_ -> putStr "take (-1)\n") -- replicate print [replicate 2 "abc", replicate 0 "abc", replicate 3 []] -- drop print [drop 5 [1..10], drop 0 [1..10], drop 5 [1..4]] - catchAllIO (print (drop (-1) [1..10])) (\_ -> putStr "drop (-1)\n") + catch (print (drop (-1) [1..10])) (\_ -> putStr "drop (-1)\n") -- splitAt print [splitAt 5 [1..10], splitAt 5 [1..4]] - catchAllIO (print (splitAt (-1) [1..10])) (\_ -> putStr "splitAt (-1)\n") + catch (print (splitAt (-1) [1..10])) (\_ -> putStr "splitAt (-1)\n") -- scan print (span (<5) [1..10]) @@ -108,11 +108,11 @@ main = do -- maximum print (maximum [1..10]) - catchAllIO (print (maximum [] :: Int)) (\_ -> putStr "maximum []\n") + catch (print (maximum [] :: Int)) (\_ -> putStr "maximum []\n") -- minimum print (minimum [1..10]) - catchAllIO (print (minimum [] :: Int)) (\_ -> putStr "minimum []\n") + catch (print (minimum [] :: Int)) (\_ -> putStr "minimum []\n") -- concatMap print (concatMap (:[]) [(1::Int)..10]) -- 1.7.10.4