Merge pull request #1 from dysinger/ghc-7.6-compat

merge in of Dysinger work for 7.6 compatibility
-Carter
This commit is contained in:
Carter Tazio Schonwald 2012-09-27 20:41:31 -07:00
commit 594590f539
3 changed files with 6 additions and 3 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ elisp/*.elc
# Where do these files come from? They're not readable. # Where do these files come from? They're not readable.
# For instance, .#Help.page # For instance, .#Help.page
# .#* # .#*
cabal-dev

View File

@ -10,6 +10,7 @@ import Data.Generics
import Data.List import Data.List
import Data.Maybe import Data.Maybe
import Data.Ord as O import Data.Ord as O
import Data.Time.Clock
import DynFlags (tracingDynFlags) import DynFlags (tracingDynFlags)
import Desugar import Desugar
import GHC import GHC
@ -118,7 +119,7 @@ infoThing str = do
mb_stuffs <- mapM getInfo names mb_stuffs <- mapM getInfo names
let filtered = filterOutChildren (\(t,_f,_i) -> t) (catMaybes mb_stuffs) let filtered = filterOutChildren (\(t,_f,_i) -> t) (catMaybes mb_stuffs)
unqual <- getPrintUnqual unqual <- getPrintUnqual
return $ showSDocForUser unqual $ vcat (intersperse (text "") $ map (pprInfo False) filtered) return $ showSDocForUser tracingDynFlags unqual $ vcat (intersperse (text "") $ map (pprInfo False) filtered)
filterOutChildren :: (a -> TyThing) -> [a] -> [a] filterOutChildren :: (a -> TyThing) -> [a] -> [a]
filterOutChildren get_thing xs filterOutChildren get_thing xs
@ -154,12 +155,12 @@ inModuleContext opt fileName modstr action errmsg =
doif setContextFromTarget action doif setContextFromTarget action
setTargetBuffer = do setTargetBuffer = do
modgraph <- depanal [mkModuleName modstr] True modgraph <- depanal [mkModuleName modstr] True
let imports = concatMap (map (showSDoc . ppr . unLoc)) $ let imports = concatMap (map ((showSDoc tracingDynFlags) . ppr . unLoc)) $
map ms_imps modgraph ++ map ms_srcimps modgraph map ms_imps modgraph ++ map ms_srcimps modgraph
moddef = "module " ++ sanitize modstr ++ " where" moddef = "module " ++ sanitize modstr ++ " where"
header = moddef : imports header = moddef : imports
importsBuf <- Gap.toStringBuffer header importsBuf <- Gap.toStringBuffer header
clkTime <- Gap.liftIO getClockTime clkTime <- Gap.liftIO getCurrentTime
setTargets [Target (TargetModule $ mkModuleName modstr) True (Just (importsBuf, clkTime))] setTargets [Target (TargetModule $ mkModuleName modstr) True (Just (importsBuf, clkTime))]
doif m t = m >>= \ok -> if ok then t else goNext doif m t = m >>= \ok -> if ok then t else goNext
sanitize = fromMaybe "SomeModule" . listToMaybe . words sanitize = fromMaybe "SomeModule" . listToMaybe . words

View File

@ -53,6 +53,7 @@ Executable ghc-mod
, hlint >= 1.7.1 , hlint >= 1.7.1
, io-choice , io-choice
, old-time , old-time
, time
, process , process
, regex-posix , regex-posix
, syb , syb