Permalink
Browse files

Fix dynCompileExpr

It broke during the ic_exports tidyup
(e.g. commit 5cd39aa).
  • Loading branch information...
1 parent 093c87f commit 984419fb7e662c009ae83514200c8430ad59dd27 @igfoo igfoo committed Oct 5, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 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

0 comments on commit 984419f

Please sign in to comment.