diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2016-05-22 05:00:51 -0400 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2016-05-22 05:01:02 -0400 |
commit | f669764f74ec6973ce62fa3488c3fefdd393212b (patch) | |
tree | d061fa996fdd9ebc1b066a29aff9a6b9455f1a53 | |
parent | c81e7b2014e284774eecf5e48e42aab31892cec1 (diff) | |
download | haskell-f669764f74ec6973ce62fa3488c3fefdd393212b.tar.gz |
Use `setSession` instead of `modifySession` when setting `HscEnv`
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2253
-rw-r--r-- | compiler/ghci/Debugger.hs | 2 | ||||
-rw-r--r-- | compiler/main/GhcMake.hs | 2 | ||||
-rw-r--r-- | compiler/main/InteractiveEval.hs | 16 |
3 files changed, 10 insertions, 10 deletions
diff --git a/compiler/ghci/Debugger.hs b/compiler/ghci/Debugger.hs index 64244729c4..acc900f688 100644 --- a/compiler/ghci/Debugger.hs +++ b/compiler/ghci/Debugger.hs @@ -121,7 +121,7 @@ bindSuspensions t = do new_ic = extendInteractiveContextWithIds ictxt ids fhvs <- liftIO $ mapM (mkFinalizedHValue hsc_env <=< mkRemoteRef) hvals liftIO $ extendLinkEnv (zip names fhvs) - modifySession $ \_ -> hsc_env {hsc_IC = new_ic } + setSession hsc_env {hsc_IC = new_ic } return t' where diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 46a49900d5..af78065bde 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -122,7 +122,7 @@ depanal excluded_mods allow_dup_roots = do mod_graphE <- liftIO $ downsweep hsc_env old_graph excluded_mods allow_dup_roots mod_graph <- reportImportErrors mod_graphE - modifySession $ \_ -> hsc_env { hsc_mod_graph = mod_graph } + setSession hsc_env { hsc_mod_graph = mod_graph } return mod_graph -- | Describes which modules of the module graph need to be loaded. diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs index e2b4c68270..e564288d21 100644 --- a/compiler/main/InteractiveEval.hs +++ b/compiler/main/InteractiveEval.hs @@ -246,7 +246,7 @@ runDeclsWithLocation source linenumber expr = setSession $ hsc_env { hsc_IC = ic } hsc_env <- getSession hsc_env' <- liftIO $ rttiEnvironment hsc_env - modifySession (\_ -> hsc_env') + setSession hsc_env' return $ filter (not . isDerivedOccName . nameOccName) -- For this filter, see Note [What to show to users] $ map getName tyThings @@ -356,7 +356,7 @@ handleRunStatus step expr bindings final_ids status history , resumeHistoryIx = 0 } hsc_env2 = pushResume hsc_env1 resume - modifySession (\_ -> hsc_env2) + setSession hsc_env2 return (ExecBreak names bp) -- Completed successfully @@ -366,7 +366,7 @@ handleRunStatus step expr bindings final_ids status history final_names = map getName final_ids liftIO $ Linker.extendLinkEnv (zip final_names hvals) hsc_env' <- liftIO $ rttiEnvironment hsc_env{hsc_IC=final_ic} - modifySession (\_ -> hsc_env') + setSession hsc_env' return (ExecComplete (Right final_names) allocs) -- Completed with an exception @@ -398,7 +398,7 @@ resumeExec canLogSpan step ic' = ic { ic_tythings = resume_tmp_te, ic_rn_gbl_env = resume_rdr_env, ic_resume = rs } - modifySession (\_ -> hsc_env{ hsc_IC = ic' }) + setSession hsc_env{ hsc_IC = ic' } -- remove any bindings created since the breakpoint from the -- linker's environment @@ -455,7 +455,7 @@ moveHist fn = do r' = r { resumeHistoryIx = new_ix } ic' = ic { ic_resume = r':rs } - modifySession (\_ -> hsc_env1{ hsc_IC = ic' }) + setSession hsc_env1{ hsc_IC = ic' } return (names, new_ix, span, decl) @@ -634,7 +634,7 @@ abandon = do case resume of [] -> return False r:rs -> do - modifySession $ \_ -> hsc_env{ hsc_IC = ic { ic_resume = rs } } + setSession hsc_env{ hsc_IC = ic { ic_resume = rs } } liftIO $ abandonStmt hsc_env (resumeContext r) return True @@ -646,7 +646,7 @@ abandonAll = do case resume of [] -> return False rs -> do - modifySession $ \_ -> hsc_env{ hsc_IC = ic { ic_resume = [] } } + setSession hsc_env{ hsc_IC = ic { ic_resume = [] } } liftIO $ mapM_ (abandonStmt hsc_env. resumeContext) rs return True @@ -697,7 +697,7 @@ setContext imports Right all_env -> do { ; let old_ic = hsc_IC hsc_env !final_rdr_env = all_env `icExtendGblRdrEnv` ic_tythings old_ic - ; modifySession $ \_ -> + ; setSession hsc_env{ hsc_IC = old_ic { ic_imports = imports , ic_rn_gbl_env = final_rdr_env }}}} where |