From: Christiaan Baaij Date: Mon, 13 Jul 2009 10:04:22 +0000 (+0200) Subject: No longer any need to explicitly load module interface in 'toCore' X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=87bdc71306c507319ff560d3dd3253e17e9c46fe;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git No longer any need to explicitly load module interface in 'toCore' We have to HscEnv from the original HaskellToCore compilation step that already includes all the module interfaces we need. --- diff --git a/CoreTools.hs b/CoreTools.hs index 3bfe1a1..3a02819 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -57,9 +57,7 @@ eval_tfp_int env ty = let letexpr = HsExpr.HsLet (HsBinds.HsValBinds $ (HsBinds.ValBindsIn binds) []) (SrcLoc.noLoc expr) - - let modules = map GHC.mkModuleName ["Types.Data.Num"] - core <- toCore modules expr + core <- toCore expr execCore core normalise_tfp_int :: HscTypes.HscEnv -> Type.Type -> Type.Type diff --git a/HsTools.hs b/HsTools.hs index 22cd57f..d132ce8 100644 --- a/HsTools.hs +++ b/HsTools.hs @@ -67,12 +67,10 @@ import CoreShow -- (==) = Prelude.(==) Int $dInt -- in -- \x = (==) x 1 -toCore :: - [Module.ModuleName] -- ^ The modules that need to be imported before translating - -- this expression. - -> HsSyn.HsExpr RdrName.RdrName -- ^ The expression to translate to Core. +toCore :: + HsSyn.HsExpr RdrName.RdrName -- ^ The expression to translate to Core. -> GHC.Ghc CoreSyn.CoreExpr -- ^ The resulting core expression. -toCore modules expr = do +toCore expr = do env <- GHC.getSession let icontext = HscTypes.hsc_IC env @@ -80,7 +78,6 @@ toCore modules expr = do -- Translage the TcRn (typecheck-rename) monad into an IO monad TcRnMonad.initTcPrintErrors env PrelNames.iNTERACTIVE $ do (tc_expr, insts) <- TcRnMonad.getLIE $ do - mapM importModule modules -- Rename the expression, resulting in a HsExpr Name (rn_expr, freevars) <- RnExpr.rnExpr expr -- Typecheck the expression, resulting in a HsExpr Id and a list of