diff --git a/Language/Haskell/GhcMod/Gap.hs b/Language/Haskell/GhcMod/Gap.hs index 41a10ae..198c3a4 100644 --- a/Language/Haskell/GhcMod/Gap.hs +++ b/Language/Haskell/GhcMod/Gap.hs @@ -42,6 +42,7 @@ module Language.Haskell.GhcMod.Gap ( , lookupModulePackageInAllPackages , Language.Haskell.GhcMod.Gap.isSynTyCon , parseModuleHeader + , mkErrStyle' ) where import Control.Applicative hiding (empty) @@ -559,3 +560,10 @@ parseModuleHeader str dflags filename = POk pst rdr_module -> let (warns,_) = getMessages pst in Right (warns, rdr_module) + +mkErrStyle' :: DynFlags -> PrintUnqualified -> PprStyle +#if __GLASGOW_HASKELL__ >= 706 +mkErrStyle' = Outputable.mkErrStyle +#else +mkErrStyle' _ = Outputable.mkErrStyle +#endif diff --git a/Language/Haskell/GhcMod/Logger.hs b/Language/Haskell/GhcMod/Logger.hs index fc3ca6e..2cb3247 100644 --- a/Language/Haskell/GhcMod/Logger.hs +++ b/Language/Haskell/GhcMod/Logger.hs @@ -134,7 +134,7 @@ ppErrMsg :: ErrMsg -> GmPprEnvM String ppErrMsg err = do dflags <- asks gpeDynFlags let unqual = errMsgContext err - st = mkErrStyle dflags unqual + st = Gap.mkErrStyle' dflags unqual let ext = showPage dflags st (errMsgExtraInfo err) m <- ppMsg st spn SevError msg return $ m ++ (if null ext then "" else "\n" ++ ext) diff --git a/test/CheckSpec.hs b/test/CheckSpec.hs index 251de2b..1ff26e2 100644 --- a/test/CheckSpec.hs +++ b/test/CheckSpec.hs @@ -71,4 +71,8 @@ spec = do it "Uses the right qualification style" $ do withDirectory_ "test/data/nice-qualification" $ do res <- runD $ checkSyntax ["NiceQualification.hs"] +#if __GLASGOW_HASKELL__ >= 708 res `shouldBe` "NiceQualification.hs:4:8:Couldn't match expected type \8216IO ()\8217 with actual type \8216[Char]\8217\NULIn the expression: \"wrong type\"\NULIn an equation for \8216main\8217: main = \"wrong type\"\n" +#else + res `shouldBe` "NiceQualification.hs:4:8:Couldn't match expected type `IO ()' with actual type `[Char]'\NULIn the expression: \"wrong type\"\NULIn an equation for `main': main = \"wrong type\"\n" +#endif