@@ -214,6 +214,9 @@ import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), constrIndex,
214 Constr, mkConstr, DataType, mkDataType, Fixity(Prefix))
214 Constr, mkConstr, DataType, mkDataType, Fixity(Prefix))
215import Data.Binary (Binary(get, put))
215import Data.Binary (Binary(get, put))
216import Data.Monoid (Monoid(..))
216import Data.Monoid (Monoid(..))
217+#if MIN_VERSION_base(4,9,0)
218+import Data.Semigroup (Semigroup(..))
217import Data.String (IsString(..))
220import Data.String (IsString(..))
218import qualified Data.Text as T
221import qualified Data.Text as T
219import qualified Data.Text.Internal as T
222import qualified Data.Text.Internal as T
@@ -335,9 +338,21 @@ instance Show Text where
335instance Read Text where
338instance Read Text where
336 readsPrec p str = [(pack x,y) | (x,y) <- readsPrec p str]
339 readsPrec p str = [(pack x,y) | (x,y) <- readsPrec p str]
341+#if MIN_VERSION_base(4,9,0)
342+-- Semigroup orphan instances for older GHCs are provided by
343+-- 'semigroups` package
345+instance Semigroup Text where
338instance Monoid Text where
349instance Monoid Text where
339 mempty = empty
350 mempty = empty
351+#if MIN_VERSION_base(4,9,0)
352+ mappend = (<>) -- future-proof definition
340 mappend = append
354 mappend = append
341 mconcat = concat
356 mconcat = concat
343instance IsString Text where
358instance IsString Text where