removing withGHCDummyFile.
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user