From a3603ec1d68a38a87926f3d3da55044043815434 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sun, 1 May 2022 16:58:43 +0100 Subject: [PATCH] Restore compat. with prettyprinter 1.6 (#2877) --- exe/Main.hs | 5 +++++ ghcide/ghcide.cabal | 4 ++-- ghcide/src/Development/IDE/Types/Logger.hs | 6 ++++++ stack-lts16.yaml | 1 - 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/exe/Main.hs b/exe/Main.hs index 56e7a7a82d0..6257b72a3ca 100644 --- a/exe/Main.hs +++ b/exe/Main.hs @@ -1,5 +1,6 @@ -- Copyright (c) 2019 The DAML Authors. All rights reserved. -- SPDX-License-Identifier: Apache-2.0 +{-# LANGUAGE CPP #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} module Main(main) where @@ -23,7 +24,11 @@ import Ide.Types (PluginDescriptor (pluginNotificat import Language.LSP.Server as LSP import Language.LSP.Types as LSP import qualified Plugins +#if MIN_VERSION_prettyprinter(1,7,0) import Prettyprinter (Pretty (pretty), vsep) +#else +import Data.Text.Prettyprint.Doc (Pretty (pretty), vsep) +#endif data Log = LogIdeMain IdeMain.Log diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index 64f59c3c799..93bd51a9502 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -2,7 +2,7 @@ cabal-version: 2.4 build-type: Simple category: Development name: ghcide -version: 1.7.0.0 +version: 1.7.0.1 license: Apache-2.0 license-file: LICENSE author: Digital Asset and Ghcide contributors @@ -72,7 +72,7 @@ library optparse-applicative, parallel, prettyprinter-ansi-terminal, - prettyprinter >= 1.7, + prettyprinter >= 1.6, random, regex-tdfa >= 1.3.1.0, retrie, diff --git a/ghcide/src/Development/IDE/Types/Logger.hs b/ghcide/src/Development/IDE/Types/Logger.hs index c57dc0f52cb..a858a5f5202 100644 --- a/ghcide/src/Development/IDE/Types/Logger.hs +++ b/ghcide/src/Development/IDE/Types/Logger.hs @@ -1,6 +1,7 @@ -- Copyright (c) 2019 The DAML Authors. All rights reserved. -- SPDX-License-Identifier: Apache-2.0 +{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} -- | This is a compatibility module that abstracts over the -- concrete choice of logging framework so users can plug in whatever @@ -54,8 +55,13 @@ import Language.LSP.Types (LogMessageParams (..), MessageType (..), SMethod (SWindowLogMessage, SWindowShowMessage), ShowMessageParams (..)) +#if MIN_VERSION_prettyprinter(1,7,0) import Prettyprinter as PrettyPrinterModule import Prettyprinter.Render.Text (renderStrict) +#else +import Data.Text.Prettyprint.Doc as PrettyPrinterModule +import Data.Text.Prettyprint.Doc.Render.Text (renderStrict) +#endif import System.IO (Handle, IOMode (AppendMode), hClose, hFlush, hSetEncoding, openFile, stderr, utf8) diff --git a/stack-lts16.yaml b/stack-lts16.yaml index 58d81a652e0..7c43657322f 100644 --- a/stack-lts16.yaml +++ b/stack-lts16.yaml @@ -65,7 +65,6 @@ extra-deps: - monad-dijkstra-0.1.1.2 - opentelemetry-0.6.1 - opentelemetry-extra-0.6.1 - - prettyprinter-1.7.1 - refinery-0.4.0.0 - retrie-1.1.0.0 - semigroups-0.18.5