summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-10-05 19:17:47 +0100
committerIan Lynagh <igloo@earth.li>2011-10-05 19:25:31 +0100
commit984419fb7e662c009ae83514200c8430ad59dd27 (patch)
tree3d8f2bfd694516c5fb757ecccda7bfebcbc03006
parent093c87f98cd9b2497adc781c7415a4793df32c08 (diff)
downloadhaskell-984419fb7e662c009ae83514200c8430ad59dd27.tar.gz
Fix dynCompileExpr
It broke during the ic_exports tidyup (e.g. commit 5cd39aa33f970ff42e22b1c9c73502e4229dc488).
-rw-r--r--compiler/main/InteractiveEval.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index c09dab81c2..b10f8e70d6 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -964,9 +964,22 @@ compileExpr expr = withSession $ \hsc_env -> do
dynCompileExpr :: GhcMonad m => String -> m Dynamic
dynCompileExpr expr = do
+ iis <- getContext
+ let importDecl = ImportDecl {
+ ideclName = noLoc (mkModuleName "Data.Dynamic"),
+ ideclPkgQual = Nothing,
+ ideclSource = False,
+ ideclSafe = False,
+ ideclQualified = True,
+ ideclImplicit = False,
+ ideclAs = Nothing,
+ ideclHiding = Nothing
+ }
+ setContext (IIDecl importDecl : iis)
let stmt = "let __dynCompileExpr = Data.Dynamic.toDyn (" ++ expr ++ ")"
Just (ids, hvals) <- withSession $ \hsc_env ->
liftIO $ hscStmt hsc_env stmt
+ setContext iis
vals <- liftIO (unsafeCoerce# hvals :: IO [Dynamic])
case (ids,vals) of
(_:[], v:[]) -> return v