diff --git a/src/HIE/Bios/Ghc/Doc.hs b/src/HIE/Bios/Ghc/Doc.hs index 122da6da..8b13d5c4 100644 --- a/src/HIE/Bios/Ghc/Doc.hs +++ b/src/HIE/Bios/Ghc/Doc.hs @@ -3,7 +3,14 @@ module HIE.Bios.Ghc.Doc where -import GHC (DynFlags, getPrintUnqual, pprCols, GhcMonad) +import GHC (DynFlags +#if __GLASGOW_HASKELL__ < 905 + , getPrintUnqual +#endif + , pprCols, GhcMonad) +#if __GLASGOW_HASKELL__ >= 905 +import GHC.Utils.Outputable +#endif #if __GLASGOW_HASKELL__ >= 900 import GHC.Driver.Session (initSDocContext) @@ -16,6 +23,11 @@ import Pretty (Mode(..), Doc, Style(..), renderStyle, style) import HIE.Bios.Ghc.Gap (makeUserStyle, pageMode, oneLineMode) +#if __GLASGOW_HASKELL__ >= 905 +getPrintUnqual :: Monad m => m NamePprCtx +getPrintUnqual = pure neverQualify +#endif + showPage :: DynFlags -> PprStyle -> SDoc -> String showPage dflag stl sdoc = showDocWith dflag pageMode $ runSDoc sdoc scontext where diff --git a/src/HIE/Bios/Ghc/Gap.hs b/src/HIE/Bios/Ghc/Gap.hs index 14115536..2d5ece4a 100644 --- a/src/HIE/Bios/Ghc/Gap.hs +++ b/src/HIE/Bios/Ghc/Gap.hs @@ -217,7 +217,9 @@ pattern RealSrcSpan t <- G.RealSrcSpan t ---------------------------------------------------------------- setNoCode :: DynFlags -> DynFlags -#if __GLASGOW_HASKELL__ >= 901 +#if __GLASGOW_HASKELL__ >= 905 +setNoCode d = d { G.backend = G.noBackend } +#elif __GLASGOW_HASKELL__ >= 901 setNoCode d = d { G.backend = G.NoBackend } #else setNoCode d = d { G.hscTarget = G.HscNothing } @@ -251,7 +253,11 @@ guessTarget a _ b = G.guessTarget a b ---------------------------------------------------------------- +#if __GLASGOW_HASKELL__ >= 905 +makeUserStyle :: DynFlags -> NamePprCtx -> PprStyle +#else makeUserStyle :: DynFlags -> PrintUnqualified -> PprStyle +#endif #if __GLASGOW_HASKELL__ >= 900 makeUserStyle _dflags style = mkUserStyle style AllTheWay #elif __GLASGOW_HASKELL__ >= 804 diff --git a/src/HIE/Bios/Ghc/Logger.hs b/src/HIE/Bios/Ghc/Logger.hs index 6bc89504..1036b1f0 100644 --- a/src/HIE/Bios/Ghc/Logger.hs +++ b/src/HIE/Bios/Ghc/Logger.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE BangPatterns, CPP #-} +{-# LANGUAGE BangPatterns, CPP, TypeApplications #-} module HIE.Bios.Ghc.Logger ( withLogger @@ -64,8 +64,10 @@ appendLogRef :: DynFlags -> Gap.PprStyle -> LogRef -> LogAction appendLogRef df style (LogRef ref) #if __GLASGOW_HASKELL__ < 903 _ _ sev src -#else +#elif __GLASGOW_HASKELL__ < 905 _ (MCDiagnostic sev _) src +#else + _ (MCDiagnostic sev _ _) src #endif #if __GLASGOW_HASKELL__ < 900 _style @@ -127,7 +129,11 @@ ppErrMsg :: DynFlags -> Gap.PprStyle -> MsgEnvelope GhcMessage -> String ppErrMsg dflag style err = ppMsg spn SevError dflag style msg -- ++ ext where spn = errMsgSpan err +#if __GLASGOW_HASKELL__ >= 905 + msg = pprLocMsgEnvelope (defaultDiagnosticOpts @GhcMessage) err +#else msg = pprLocMsgEnvelope err +#endif -- fixme #elif __GLASGOW_HASKELL__ >= 902 errBagToStrList :: DynFlags -> Gap.PprStyle -> Bag (MsgEnvelope DecoratedSDoc) -> [String]