Commit adea8279 authored by Edward Z. Yang's avatar Edward Z. Yang

Add ExceptionMonad instance for IOEnv.

Signed-off-by: default avatarEdward Z. Yang <>
parent 0b12aca0
......@@ -93,6 +93,16 @@ instance Show IOEnvFailure where
instance Exception IOEnvFailure
instance ExceptionMonad (IOEnv a) where
gcatch act handle =
IOEnv $ \s -> unIOEnv act s `gcatch` \e -> unIOEnv (handle e) s
gmask f =
IOEnv $ \s -> gmask $ \io_restore ->
g_restore (IOEnv m) = IOEnv $ \s -> io_restore (m s)
unIOEnv (f g_restore) s
instance ContainsDynFlags env => HasDynFlags (IOEnv env) where
getDynFlags = do env <- getEnv
return $ extractDynFlags env
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment