more applicative.

error msg fix.
This commit is contained in:
Kazu Yamamoto
2012-02-15 14:52:48 +09:00
parent 7474968486
commit 96cbf68e16
6 changed files with 34 additions and 32 deletions

View File

@@ -1,6 +1,7 @@
module GHCApi where
import Control.Monad
import Control.Exception
import Control.Applicative
import CoreMonad
import DynFlags
import ErrMsg
@@ -11,13 +12,13 @@ import Types
----------------------------------------------------------------
withGHC :: (MonadPlus m) => Ghc (m a) -> IO (m a)
withGHC :: Alternative m => Ghc (m a) -> IO (m a)
withGHC body = ghandle ignore $ runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
defaultCleanupHandler dflags body
where
ignore :: (MonadPlus m) => SomeException -> IO (m a)
ignore _ = return mzero
ignore :: Alternative m => SomeException -> IO (m a)
ignore _ = return empty
----------------------------------------------------------------