projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c6dd9e2
)
Add a runTcM utility function.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Thu, 9 Apr 2009 14:01:39 +0000
(16:01 +0200)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Thu, 9 Apr 2009 14:01:39 +0000
(16:01 +0200)
GhcTools.hs
patch
|
blob
|
history
diff --git
a/GhcTools.hs
b/GhcTools.hs
index dcfab0fe4920e3302ebb2d0bd0be92563127220c..9c5038cfd42586ba8ccd6c7b1aca998d06a8b7b7 100644
(file)
--- a/
GhcTools.hs
+++ b/
GhcTools.hs
@@
-6,6
+6,10
@@
import qualified System.IO.Unsafe
import qualified GHC
import qualified GHC.Paths
import qualified DynFlags
import qualified GHC
import qualified GHC.Paths
import qualified DynFlags
+import qualified TcRnMonad
+import qualified MonadUtils
+import qualified HscTypes
+import qualified PrelNames
-- Change a DynFlag from within the Ghc monad. Strangely enough there seems to
-- be no standard function to do exactly this.
-- Change a DynFlag from within the Ghc monad. Strangely enough there seems to
-- be no standard function to do exactly this.
@@
-29,3
+33,12
@@
unsafeRunGhc m =
dflags <- GHC.getSessionDynFlags
GHC.setSessionDynFlags dflags
m
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