rescue old GHCs.

This commit is contained in:
Kazu Yamamoto 2014-04-28 09:00:03 +09:00
parent 017d4cc22f
commit 2733f94a52

View File

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