X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FUtils%2FGhcTools.hs;h=3f032d901203325fb52cac1dd3ebef6541a8ccec;hb=89d205565ee7b8c7f4da92861e22a69687d659cf;hp=5f6e671807b03eac3b55f38fbc9934d757078f38;hpb=b2967df7f237e5b4db15d069895ca01c31712d9e;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/Utils/GhcTools.hs" "b/c\316\273ash/CLasH/Utils/GhcTools.hs" index 5f6e671..3f032d9 100644 --- "a/c\316\273ash/CLasH/Utils/GhcTools.hs" +++ "b/c\316\273ash/CLasH/Utils/GhcTools.hs" @@ -4,7 +4,6 @@ import qualified System.IO.Unsafe -- GHC API import qualified GHC -import qualified GHC.Paths import qualified DynFlags import qualified TcRnMonad import qualified MonadUtils @@ -26,19 +25,19 @@ setDynFlag dflag = do -- don't have side effects themselves (Or rather, that don't use -- unsafePerformIO themselves, since normal side effectful function would -- just return an IO monad when they are evaluated). -unsafeRunGhc :: GHC.Ghc a -> a -unsafeRunGhc m = - System.IO.Unsafe.unsafePerformIO $ - GHC.runGhc (Just GHC.Paths.libdir) $ do +unsafeRunGhc :: FilePath -> GHC.Ghc a -> a +unsafeRunGhc libDir m = + System.IO.Unsafe.unsafePerformIO $ do + GHC.runGhc (Just libDir) $ do dflags <- GHC.getSessionDynFlags GHC.setSessionDynFlags dflags m -runTcM :: TcRnMonad.TcM a -> IO a -runTcM thing_inside = do - GHC.runGhc (Just GHC.Paths.libdir) $ do - dflags <- GHC.getSessionDynFlags - GHC.setSessionDynFlags dflags - env <- GHC.getSession - HscTypes.ioMsgMaybe . MonadUtils.liftIO . TcRnMonad.initTcPrintErrors env PrelNames.iNTERACTIVE $ do - thing_inside +-- runTcM :: TcRnMonad.TcM a -> IO a +-- runTcM thing_inside = do +-- GHC.runGhc (Just GHC.Paths.libdir) $ do +-- dflags <- GHC.getSessionDynFlags +-- GHC.setSessionDynFlags dflags +-- env <- GHC.getSession +-- HscTypes.ioMsgMaybe . MonadUtils.liftIO . TcRnMonad.initTcPrintErrors env PrelNames.iNTERACTIVE $ do +-- thing_inside