From 984419fb7e662c009ae83514200c8430ad59dd27 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 5 Oct 2011 19:17:47 +0100 Subject: Fix dynCompileExpr It broke during the ic_exports tidyup (e.g. commit 5cd39aa33f970ff42e22b1c9c73502e4229dc488). --- compiler/main/InteractiveEval.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'compiler/main/InteractiveEval.hs') 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 -- cgit v1.2.1