From a76be76141a6ec3cf401a8b3c263eaa87e083237 Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Thu, 11 Jan 2018 06:39:54 +0300 Subject: [PATCH 1/3] Functions: disambiguate the (<>) to not conflict with GHC 8.4 base --- Data/Text/Format/Functions.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Text/Format/Functions.hs b/Data/Text/Format/Functions.hs index f10dd77..795d856 100644 --- a/Data/Text/Format/Functions.hs +++ b/Data/Text/Format/Functions.hs @@ -13,7 +13,7 @@ module Data.Text.Format.Functions ( - (<>) + (Data.Text.Format.Functions.<>) , i2d ) where From cc25530dbfbc8d16706e6f8ddac86c1697cfa63c Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Thu, 11 Jan 2018 06:44:50 +0300 Subject: [PATCH 2/3] Format: add a Semigroup instance (GHC 8.4 compat) --- Data/Text/Format/Types/Internal.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Data/Text/Format/Types/Internal.hs b/Data/Text/Format/Types/Internal.hs index 2eaccb2..c39e111 100644 --- a/Data/Text/Format/Types/Internal.hs +++ b/Data/Text/Format/Types/Internal.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving #-} +{-# LANGUAGE CPP, DeriveDataTypeable, GeneralizedNewtypeDeriving #-} -- | -- Module : Data.Text.Format.Types.Internal @@ -47,8 +47,13 @@ newtype Format = Format { fromFormat :: Text } deriving (Eq, Ord, Typeable, Show) instance Monoid Format where - Format a `mappend` Format b = Format (a `mappend` b) mempty = Format mempty +#if !MIN_VERSION_base(4,11,0) + Format a `mappend` Format b = Format (a `mappend` b) +#else +instance Semigroup Format where + Format a <> Format b = Format (a <> b) +#endif instance IsString Format where fromString = Format . fromString From a1cda87c222d422816f956c7272e752ea12dbe19 Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Thu, 11 Jan 2018 06:48:34 +0300 Subject: [PATCH 3/3] globally: hide Prelude.<>, where appropriate --- Data/Text/Buildable.hs | 3 +++ Data/Text/Format.hs | 8 ++++++-- Data/Text/Format/Int.hs | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Data/Text/Buildable.hs b/Data/Text/Buildable.hs index 4888eb4..c810db8 100644 --- a/Data/Text/Buildable.hs +++ b/Data/Text/Buildable.hs @@ -37,6 +37,9 @@ import Foreign.Ptr (IntPtr, WordPtr, Ptr, ptrToWordPtr) import qualified Data.Double.Conversion.Text as C import qualified Data.Text as ST import qualified Data.Text.Lazy as LT +#if MIN_VERSION_base(4,11,0) +import Prelude hiding ((<>)) +#endif -- | The class of types that can be rendered to a 'Builder'. class Buildable p where diff --git a/Data/Text/Format.hs b/Data/Text/Format.hs index 7a7f725..6363f15 100644 --- a/Data/Text/Format.hs +++ b/Data/Text/Format.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE OverloadedStrings, RelaxedPolyRec #-} +{-# LANGUAGE CPP, OverloadedStrings, RelaxedPolyRec #-} -- | -- Module : Data.Text.Format @@ -41,7 +41,11 @@ import Data.Text.Format.Params (Params(..)) import Data.Text.Format.Types.Internal (Format(..), Only(..), Shown(..)) import Data.Text.Format.Types.Internal (Hex(..)) import Data.Text.Lazy.Builder -import Prelude hiding (exp, print) +import Prelude hiding (exp, print +#if MIN_VERSION_base(4,11,0) + , (<>) +#endif + ) import System.IO (Handle) import qualified Data.Double.Conversion.Text as C import qualified Data.Text as ST diff --git a/Data/Text/Format/Int.hs b/Data/Text/Format/Int.hs index 37858c9..5af6158 100644 --- a/Data/Text/Format/Int.hs +++ b/Data/Text/Format/Int.hs @@ -24,6 +24,9 @@ import Data.Word (Word, Word8, Word16, Word32, Word64) import GHC.Base (quotInt, remInt) import GHC.Num (quotRemInteger) import GHC.Types (Int(..)) +#if MIN_VERSION_base(4,11,0) +import Prelude hiding ((<>)) +#endif #ifdef __GLASGOW_HASKELL__ # if __GLASGOW_HASKELL__ < 611