> This : > Prelude> let f = (\x -> return "something went wrong") :: IOError -> IO > String > Prelude> let t = return $ show $ "too short list" !! 100 :: IO String > Prelude> catch t f > "*** Exception: Prelude.(!!): index too large > > doesn't work.
You might be interested in the difference between Prelude.catch and Control.Exception.catch Though in an example like that, you'll need to force evaluation to actually catch the exception. f _ = return "something went wrong" t = return $! show $ "too short list" !! 100 ... Control.Exception.catch t f (note $! instead of $ in "t".) Donn Cave, [EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe