From c7bd0d88637696d46ea02a79a5686b2d79b0ef26 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 7 Dec 2012 14:27:02 +0900 Subject: [PATCH] "Dummy:0:0" -> ":0:0". --- Check.hs | 2 +- GHCApi.hs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Check.hs b/Check.hs index f891ae7..8f65af7 100644 --- a/Check.hs +++ b/Check.hs @@ -18,7 +18,7 @@ checkSyntax opt file = unlines <$> check opt file ---------------------------------------------------------------- check :: Options -> String -> IO [String] -check opt fileName = withGHC $ checkIt `gcatch` handleErrMsg +check opt fileName = withGHC' fileName $ checkIt `gcatch` handleErrMsg where checkIt = do (file,readLog) <- initializeGHC opt fileName options True diff --git a/GHCApi.hs b/GHCApi.hs index 337f879..259b769 100644 --- a/GHCApi.hs +++ b/GHCApi.hs @@ -15,13 +15,16 @@ import Types ---------------------------------------------------------------- withGHC :: Alternative m => Ghc (m a) -> IO (m a) -withGHC body = ghandle ignore $ runGhc (Just libdir) $ do +withGHC = withGHC' "Dummy" + +withGHC' :: Alternative m => FilePath -> Ghc (m a) -> IO (m a) +withGHC' file body = ghandle ignore $ runGhc (Just libdir) $ do dflags <- getSessionDynFlags defaultCleanupHandler dflags body where ignore :: Alternative m => SomeException -> IO (m a) ignore e = do - hPutStr stderr "Dummy:0:0:Error:" + hPutStr stderr $ file ++ ":0:0:Error:" hPrint stderr e exitSuccess