[Make MyInterpret use new-style exceptions, avoid compiler warnings Joachim Breitner **20100904105415 Ignore-this: af8ccc8e5a316cd3b9b3e2a2dd423abe ] hunk ./MyInterpret.hs 11 -import Language.Haskell.Interpreter.GHC.Unsafe +import Language.Haskell.Interpreter.Unsafe hunk ./MyInterpret.hs 15 -import Control.OldException +import Control.Exception hunk ./MyInterpret.hs 29 -data MyException = MyException String deriving (Typeable) +data MyException = MyException String deriving (Show,Typeable) +instance Exception MyException hunk ./MyInterpret.hs 34 - installHandler sigXCPU (CatchOnce $ throwDynTo mainId $ MyException "Time limit exceeded.") Nothing + installHandler sigXCPU (CatchOnce $ throwTo mainId $ MyException "Time limit exceeded.") Nothing hunk ./MyInterpret.hs 38 - throwDynTo mainId (MyException "Time limit exceeded") + throwTo mainId (MyException "Time limit exceeded") hunk ./MyInterpret.hs 54 - (throwTo mainId) + (\e -> throwTo mainId (e::SomeException)) hunk ./MyInterpret.hs 60 -myInterpreter :: (String -> InterpreterT IO [a]) -> String -> IO [a] -myInterpreter todo exp = timeoutIO $ do - when (unsafe exp) $ throwDyn (MyException "Indicators for unsafe computations found in exp") +myInterpreter :: [String] -> [String] -> (String -> InterpreterT IO [a]) -> String -> IO [a] +myInterpreter mods imports todo exp = timeoutIO $ do + when (unsafe exp) $ throw (MyException "Indicators for unsafe computations found in exp") hunk ./MyInterpret.hs 85 -formatInterpreterError (UnknownError s) = "Unknown Interpreter Error " ++ s +formatInterpreterError (UnknownError s) = "Unknown Interpreter Error:\n" ++ s hunk ./MyInterpret.hs 108 - flip catchDyn (return . Left . formatInterpreterError) $ - flip catchDyn (\(MyException s) -> return (Left s)) $ - handleJust errorCalls (return . Left) $ -- bff in Bff.hs uses these + flip catch (return . Left . formatInterpreterError) $ + flip catch (\(MyException s) -> return (Left s)) $ + flip catch (\(ErrorCall s) -> return (Left s)) $