Thanks to DeferTypeErrors, info/type can work even if the file contains errors.

This commit is contained in:
Kazu Yamamoto
2014-04-26 11:43:30 +09:00
parent 66a5123f8c
commit c8fbdcfa2f
3 changed files with 37 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ module Language.Haskell.GhcMod.GHCApi (
, addTargetFiles
, getDynamicFlags
, getSystemLibDir
, withDynFlags
) where
import Language.Haskell.GhcMod.CabalApi
@@ -191,3 +192,12 @@ getDynamicFlags :: IO DynFlags
getDynamicFlags = do
mlibdir <- getSystemLibDir
G.runGhc mlibdir G.getSessionDynFlags
withDynFlags :: (DynFlags -> DynFlags) -> Ghc a -> Ghc a
withDynFlags setFlag body = G.gbracket setup teardown (\_ -> body)
where
setup = do
dflag <- G.getSessionDynFlags
void $ G.setSessionDynFlags (setFlag dflag)
return dflag
teardown = void . G.setSessionDynFlags