use Control.Exception's brackets
This commit is contained in:
parent
a72f0ecc27
commit
9a67f9cb8d
1 changed files with 2 additions and 3 deletions
5
test.hs
5
test.hs
|
@ -11,7 +11,7 @@ import Test.QuickCheck
|
||||||
|
|
||||||
import System.Posix.Directory (changeWorkingDirectory)
|
import System.Posix.Directory (changeWorkingDirectory)
|
||||||
import System.Posix.Files
|
import System.Posix.Files
|
||||||
import IO (bracket_, bracket)
|
import Control.Exception (bracket_, bracket)
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
import System.Posix.Env
|
import System.Posix.Env
|
||||||
import qualified Control.Exception.Extensible as E
|
import qualified Control.Exception.Extensible as E
|
||||||
|
@ -523,8 +523,7 @@ indir dir a = do
|
||||||
-- Assertion failures throw non-IO errors; catch
|
-- Assertion failures throw non-IO errors; catch
|
||||||
-- any type of error and change back to cwd before
|
-- any type of error and change back to cwd before
|
||||||
-- rethrowing.
|
-- rethrowing.
|
||||||
r <- bracket_ (changeToTmpDir dir)
|
r <- bracket_ (changeToTmpDir dir) (changeWorkingDirectory cwd)
|
||||||
(\_ -> changeWorkingDirectory cwd)
|
|
||||||
(E.try (a)::IO (Either E.SomeException ()))
|
(E.try (a)::IO (Either E.SomeException ()))
|
||||||
case r of
|
case r of
|
||||||
Right () -> return ()
|
Right () -> return ()
|
||||||
|
|
Loading…
Reference in a new issue