Moved to new GHC API (6.11). Also use vhdl package for the VHDL AST
[matthijs/master-project/cλash.git] / HsTools.hs
index 22cd57f06de9d90350cb2c39e67b90b254ba058d..1bad94167b9f0a5d197798ba290e7c477dd2511e 100644 (file)
@@ -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
@@ -165,7 +162,7 @@ execCore expr = do
         -- to run an IO-monad-inside-a-GHC-monad for some reason. I don't really
         -- understand what it means, but it works.
         env <- GHC.getSession
-        let srcspan = SrcLoc.mkGeneralSrcSpan (FastString.fsLit "XXX")
+        let srcspan = SrcLoc.noSrcSpan
         hval <- MonadUtils.liftIO $ HscMain.compileExpr env srcspan expr
         let res = Unsafe.Coerce.unsafeCoerce hval :: Int
         return $ Unsafe.Coerce.unsafeCoerce hval