removing withGHCDummyFile.

This commit is contained in:
Kazu Yamamoto
2014-04-23 16:37:24 +09:00
parent b9d4b9b66f
commit 79946f9a3d
5 changed files with 36 additions and 35 deletions

View File

@@ -2,7 +2,7 @@
module Language.Haskell.GhcMod.GHCApi (
withGHC
, withGHCDummyFile
, withGHC'
, initializeFlagsWithCradle
, setTargetFiles
, addTargetFiles
@@ -42,20 +42,11 @@ getSystemLibDir = do
----------------------------------------------------------------
-- | Converting the 'Ghc' monad to the 'IO' monad.
withGHCDummyFile :: Ghc a -- ^ 'Ghc' actions created by the Ghc utilities.
-> IO a
withGHCDummyFile = withGHC "Dummy"
-- | Converting the 'Ghc' monad to the 'IO' monad.
withGHC :: FilePath -- ^ A target file displayed in an error message.
-> Ghc a -- ^ 'Ghc' actions created by the Ghc utilities.
-> IO a
withGHC file body = do
mlibdir <- getSystemLibDir
ghandle ignore $ G.runGhc mlibdir $ do
dflags <- G.getSessionDynFlags
G.defaultCleanupHandler dflags body
withGHC file body = ghandle ignore $ withGHC' body
where
ignore :: SomeException -> IO a
ignore e = do
@@ -63,6 +54,13 @@ withGHC file body = do
hPrint stderr e
exitSuccess
withGHC' :: Ghc a -> IO a
withGHC' body = do
mlibdir <- getSystemLibDir
G.runGhc mlibdir $ do
dflags <- G.getSessionDynFlags
G.defaultCleanupHandler dflags body
----------------------------------------------------------------
importDirs :: [IncludeDir]