Fix ghc-7.6 compile time errors
This commit is contained in:
parent
b242df63dc
commit
d7a00ffcca
@ -60,7 +60,7 @@ debugInfo = do
|
||||
, "System GHC Version: " ++ ghcVersion
|
||||
, "Root directory: " ++ cradleRootDir
|
||||
, "Current directory: " ++ cradleCurrentDir
|
||||
, "GHC Package flags:\n" ++ render (nest 4 $
|
||||
, "GHC Package flags:\n" ++ renderGm (nest 4 $
|
||||
fsep $ map text pkgOpts)
|
||||
, "GHC System libraries: " ++ ghcLibDir
|
||||
] ++ cabal
|
||||
@ -98,17 +98,17 @@ cabalDebug ghcPkgPath = do
|
||||
|
||||
return $
|
||||
[ "cabal-install Version: " ++ cabalInstVersion
|
||||
, "Cabal Library Versions:\n" ++ render (nest 4 $
|
||||
, "Cabal Library Versions:\n" ++ renderGm (nest 4 $
|
||||
fsep $ map text cabalPackages)
|
||||
, "Cabal file: " ++ show cradleCabalFile
|
||||
, "Project: " ++ show cradleProject
|
||||
, "Cabal entrypoints:\n" ++ render (nest 4 $
|
||||
, "Cabal entrypoints:\n" ++ renderGm (nest 4 $
|
||||
mapDoc gmComponentNameDoc smpDoc entrypoints)
|
||||
, "Cabal components:\n" ++ render (nest 4 $
|
||||
, "Cabal components:\n" ++ renderGm (nest 4 $
|
||||
mapDoc gmComponentNameDoc graphDoc graphs)
|
||||
, "GHC Cabal options:\n" ++ render (nest 4 $
|
||||
, "GHC Cabal options:\n" ++ renderGm (nest 4 $
|
||||
mapDoc gmComponentNameDoc (fsep . map text) opts)
|
||||
, "GHC search path options:\n" ++ render (nest 4 $
|
||||
, "GHC search path options:\n" ++ renderGm (nest 4 $
|
||||
mapDoc gmComponentNameDoc (fsep . map text) srcOpts)
|
||||
]
|
||||
|
||||
@ -126,11 +126,11 @@ componentInfo ts = do
|
||||
opts <- targetGhcOptions crdl sefnmn
|
||||
|
||||
return $ unlines $
|
||||
[ "Matching Components:\n" ++ render (nest 4 $
|
||||
[ "Matching Components:\n" ++ renderGm (nest 4 $
|
||||
alistDoc (either text mnDoc) (setDoc gmComponentNameDoc) mdlcs)
|
||||
, "Picked Component:\n" ++ render (nest 4 $
|
||||
, "Picked Component:\n" ++ renderGm (nest 4 $
|
||||
gmComponentNameDoc cn)
|
||||
, "GHC Cabal options:\n" ++ render (nest 4 $ fsep $ map text opts)
|
||||
, "GHC Cabal options:\n" ++ renderGm (nest 4 $ fsep $ map text opts)
|
||||
]
|
||||
where
|
||||
zipMap f l = l `zip` (f `map` l)
|
||||
|
@ -31,7 +31,7 @@ module Language.Haskell.GhcMod.Gap (
|
||||
, occNameForUser
|
||||
, deSugar
|
||||
, showDocWith
|
||||
, render
|
||||
, renderGm
|
||||
, GapThing(..)
|
||||
, fromTyThing
|
||||
, fileModSummary
|
||||
@ -201,19 +201,21 @@ showDocWith dflags mode = Pretty.showDoc mode (pprCols dflags)
|
||||
showDocWith _ = Pretty.showDocWith
|
||||
#endif
|
||||
|
||||
render :: Pretty.Doc -> String
|
||||
renderGm :: Pretty.Doc -> String
|
||||
#if __GLASGOW_HASKELL__ >= 800
|
||||
render = Pretty.fullRender Pretty.PageMode 80 1.2 string_txt ""
|
||||
renderGm = Pretty.fullRender Pretty.PageMode 80 1.2 string_txt ""
|
||||
#else
|
||||
render = Pretty.fullRender Pretty.PageMode 80 1.2 string_txt ""
|
||||
renderGm = Pretty.fullRender Pretty.PageMode 80 1.2 string_txt ""
|
||||
#endif
|
||||
where
|
||||
string_txt :: Pretty.TextDetails -> String -> String
|
||||
string_txt (Pretty.Chr c) s = c:s
|
||||
string_txt (Pretty.Str s1) s2 = s1 ++ s2
|
||||
string_txt (Pretty.PStr s1) s2 = unpackFS s1 ++ s2
|
||||
string_txt (Pretty.ZStr s1) s2 = zString s1 ++ s2
|
||||
string_txt (Pretty.LStr s1 _) s2 = unpackLitString s1 ++ s2
|
||||
#if __GLASGOW_HASKELL__ >= 708
|
||||
string_txt (Pretty.ZStr s1) s2 = zString s1 ++ s2
|
||||
#endif
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
@ -99,7 +99,7 @@ withLogger' env action = do
|
||||
let setLogger df = Gap.setLogAction df $ appendLogRef rfm df logref
|
||||
handlers = [
|
||||
GHandler $ \ex -> return $ Left $ runReader (sourceError ex) gpe,
|
||||
GHandler $ \ex -> return $ Left [render $ ghcExceptionDoc ex]
|
||||
GHandler $ \ex -> return $ Left [renderGm $ ghcExceptionDoc ex]
|
||||
]
|
||||
gpe = GmPprEnv {
|
||||
gpeDynFlags = hsc_dflags env
|
||||
|
@ -78,7 +78,7 @@ gmLog level loc' doc = do
|
||||
let loc | loc' == "" = empty
|
||||
| otherwise = text loc' <+>: empty
|
||||
msgDoc = sep [loc, doc]
|
||||
msg = dropWhileEnd isSpace $ render $ gmLogLevelDoc level <+>: msgDoc
|
||||
msg = dropWhileEnd isSpace $ renderGm $ gmLogLevelDoc level <+>: msgDoc
|
||||
|
||||
when (level <= level') $ gmErrStrLn msg
|
||||
gmLogQuiet level loc' doc
|
||||
|
@ -15,7 +15,7 @@
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
module Language.Haskell.GhcMod.Pretty
|
||||
( render
|
||||
( renderGm
|
||||
, renderSDoc
|
||||
, gmComponentNameDoc
|
||||
, gmLogLevelDoc
|
||||
@ -37,7 +37,7 @@ import Outputable (SDoc, withPprStyleDoc)
|
||||
|
||||
import Language.Haskell.GhcMod.Types
|
||||
import Language.Haskell.GhcMod.Doc
|
||||
import Language.Haskell.GhcMod.Gap (render)
|
||||
import Language.Haskell.GhcMod.Gap (renderGm)
|
||||
|
||||
renderSDoc :: GhcMonad m => SDoc -> m Doc
|
||||
renderSDoc sdoc = do
|
||||
|
@ -39,7 +39,7 @@ main =
|
||||
hSetEncoding stdin enc
|
||||
catches (progMain res) [
|
||||
Handler $ \(e :: GhcModError) ->
|
||||
runGmOutT globalOptions $ exitError $ render (gmeDoc e)
|
||||
runGmOutT globalOptions $ exitError $ renderGm (gmeDoc e)
|
||||
]
|
||||
|
||||
progMain :: (Options, GhcModCommands) -> IO ()
|
||||
@ -121,7 +121,7 @@ wrapGhcCommands opts cmd =
|
||||
Right _ ->
|
||||
return ()
|
||||
Left ed ->
|
||||
exitError $ render (gmeDoc ed)
|
||||
exitError $ renderGm (gmeDoc ed)
|
||||
|
||||
loadMMappedFiles from (Just to) = loadMappedFile from to
|
||||
loadMMappedFiles from (Nothing) = do
|
||||
|
Loading…
Reference in New Issue
Block a user