diff options
author | Ian Lynagh <igloo@earth.li> | 2008-07-31 17:33:54 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-07-31 17:33:54 +0000 |
commit | 81466110ff8104ca60e20d617bab83f6f78f0ec2 (patch) | |
tree | bf6432b8838cbd01c6c2a2a00c39f4af5e462fb9 /compiler/utils/IOEnv.hs | |
parent | e61fe59d9567fbad053a87f897e6c8198dc95794 (diff) | |
download | haskell-81466110ff8104ca60e20d617bab83f6f78f0ec2.tar.gz |
Follow changes in the base library
TopHandler now uses the new extensible exceptions module, so we
need to interact with it using the new types.
Diffstat (limited to 'compiler/utils/IOEnv.hs')
-rw-r--r-- | compiler/utils/IOEnv.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs index ca2bdfc9ff..0cad752892 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 ErrorCall 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)) --------------------------- |