don't use InteractiveImport for old GHCs..

This commit is contained in:
Kazu Yamamoto 2014-04-27 22:48:24 +09:00
parent 4d2ef23f33
commit 017d4cc22f

View File

@ -202,23 +202,21 @@ withContext action = gbracket setup teardown body
body _ = do body _ = do
topImports >>= setContext topImports >>= setContext
action action
topImports = do
topImports :: Ghc [InteractiveImport] mss <- getModuleGraph
topImports = do
mss <- getModuleGraph
#if __GLASGOW_HASKELL__ >= 706 #if __GLASGOW_HASKELL__ >= 706
let modName = IIModule . moduleName . ms_mod let modName = IIModule . moduleName . ms_mod
#elif __GLASGOW_HASKELL__ >= 704 #elif __GLASGOW_HASKELL__ >= 704
let modName = IIModule . ms_mod let modName = IIModule . ms_mod
#else #else
let modName = ms_mod let modName = ms_mod
#endif #endif
map modName <$> filterM isTop mss map modName <$> filterM isTop mss
where
isTop mos = lookupMod ||> returnFalse
where where
lookupMod = lookupModule (ms_mod_name mos) Nothing >> return True isTop mos = lookupMod ||> returnFalse
returnFalse = return False where
lookupMod = lookupModule (ms_mod_name mos) Nothing >> return True
returnFalse = return False
showSeverityCaption :: Severity -> String showSeverityCaption :: Severity -> String
#if __GLASGOW_HASKELL__ >= 706 #if __GLASGOW_HASKELL__ >= 706