projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0323459
)
Use bracket_ rather than bracket in withExtendedLinkEnv
author
Ian Lynagh
<igloo@earth.li>
Sat, 14 Jun 2008 21:14:14 +0000
(21:14 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Sat, 14 Jun 2008 21:14:14 +0000
(21:14 +0000)
compiler/ghci/Linker.lhs
patch
|
blob
|
history
diff --git
a/compiler/ghci/Linker.lhs
b/compiler/ghci/Linker.lhs
index
fbef432
..
712904d
100644
(file)
--- a/
compiler/ghci/Linker.lhs
+++ b/
compiler/ghci/Linker.lhs
@@
-293,22
+293,22
@@
linkDependencies hsc_env span needed_mods = do
withExtendedLinkEnv :: [(Name,HValue)] -> IO a -> IO a
withExtendedLinkEnv new_env action
withExtendedLinkEnv :: [(Name,HValue)] -> IO a -> IO a
withExtendedLinkEnv new_env action
- = bracket set_new_env
- reset_old_env
- (const action)
+ = bracket_ set_new_env
+ reset_old_env
+ action
where set_new_env = do
pls <- readIORef v_PersistentLinkerState
let new_closure_env = extendClosureEnv (closure_env pls) new_env
new_pls = pls { closure_env = new_closure_env }
writeIORef v_PersistentLinkerState new_pls
where set_new_env = do
pls <- readIORef v_PersistentLinkerState
let new_closure_env = extendClosureEnv (closure_env pls) new_env
new_pls = pls { closure_env = new_closure_env }
writeIORef v_PersistentLinkerState new_pls
- return (closure_env pls)
+ return ()
-- Remember that the linker state might be side-effected
-- during the execution of the IO action, and we don't want to
-- lose those changes (we might have linked a new module or
-- package), so the reset action only removes the names we
-- added earlier.
-- Remember that the linker state might be side-effected
-- during the execution of the IO action, and we don't want to
-- lose those changes (we might have linked a new module or
-- package), so the reset action only removes the names we
-- added earlier.
- reset_old_env env = do
+ reset_old_env = do
modifyIORef v_PersistentLinkerState $ \pls ->
let cur = closure_env pls
new = delListFromNameEnv cur (map fst new_env)
modifyIORef v_PersistentLinkerState $ \pls ->
let cur = closure_env pls
new = delListFromNameEnv cur (map fst new_env)