Skip to content

Commit cc25530

Browse files
committed
Format: add a Semigroup instance (GHC 8.4 compat)
1 parent a76be76 commit cc25530

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Data/Text/Format/Types/Internal.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
1+
{-# LANGUAGE CPP, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
22

33
-- |
44
-- Module : Data.Text.Format.Types.Internal
@@ -47,8 +47,13 @@ newtype Format = Format { fromFormat :: Text }
4747
deriving (Eq, Ord, Typeable, Show)
4848

4949
instance Monoid Format where
50-
Format a `mappend` Format b = Format (a `mappend` b)
5150
mempty = Format mempty
51+
#if !MIN_VERSION_base(4,11,0)
52+
Format a `mappend` Format b = Format (a `mappend` b)
53+
#else
54+
instance Semigroup Format where
55+
Format a <> Format b = Format (a <> b)
56+
#endif
5257

5358
instance IsString Format where
5459
fromString = Format . fromString

0 commit comments

Comments
 (0)