X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FIOEnv.hs;h=394a1c8f451f81745e441cea0bb6c53a17c04394;hb=ec197dfef33654dd16b5832905dad2e52f79f7ab;hp=ca2bdfc9ffef8778d3af65d2433e06711269353a;hpb=15bef2b43ef7c90cb2a981a1a43b60bf878e64dc;p=ghc-hetmet.git diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs index ca2bdfc..394a1c8 100644 --- a/compiler/utils/IOEnv.hs +++ b/compiler/utils/IOEnv.hs @@ -23,7 +23,8 @@ module IOEnv ( IORef, newMutVar, readMutVar, writeMutVar, updMutVar ) where -import Panic ( try, tryUser, tryMost, Exception(..) ) +import Exception +import Panic import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef ) import System.IO.Unsafe ( unsafeInterleaveIO ) @@ -94,7 +95,11 @@ fixM f = IOEnv (\ env -> fixIO (\ r -> unIOEnv (f r) env)) --------------------------- +#if __GLASGOW_HASKELL__ < 609 tryM :: IOEnv env r -> IOEnv env (Either Exception r) +#else +tryM :: IOEnv env r -> IOEnv env (Either IOException r) +#endif -- Reflect UserError exceptions (only) into IOEnv monad -- Other exceptions are not caught; they are simply propagated as exns -- @@ -104,13 +109,14 @@ tryM :: IOEnv env r -> IOEnv env (Either Exception r) -- begin compiled! tryM (IOEnv thing) = IOEnv (\ env -> tryUser (thing env)) -tryAllM :: IOEnv env r -> IOEnv env (Either Exception r) +-- XXX We shouldn't be catching everything, e.g. timeouts +tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r) -- Catch *all* exceptions -- This is used when running a Template-Haskell splice, when -- even a pattern-match failure is a programmer error tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env)) -tryMostM :: IOEnv env r -> IOEnv env (Either Exception r) +tryMostM :: IOEnv env r -> IOEnv env (Either SomeException r) tryMostM (IOEnv thing) = IOEnv (\ env -> tryMost (thing env)) ---------------------------