@@ -214,6 +214,9 @@ import Data.Data (Data(gfoldl, toConstr, gunfold, dataTypeOf), constrIndex,
214214 Constr, mkConstr, DataType, mkDataType, Fixity(Prefix))
215215import Data.Binary (Binary(get, put))
216216import Data.Monoid (Monoid(..))
217+#if MIN_VERSION_base(4,9,0)
218+import Data.Semigroup (Semigroup(..))
219+#endif
217220import Data.String (IsString(..))
218221import qualified Data.Text as T
219222import qualified Data.Text.Internal as T
@@ -335,9 +338,21 @@ instance Show Text where
335338instance Read Text where
336339 readsPrec p str = [(pack x,y) | (x,y) <- readsPrec p str]
337340
341+#if MIN_VERSION_base(4,9,0)
342+-- Semigroup orphan instances for older GHCs are provided by
343+-- 'semigroups` package
344+
345+instance Semigroup Text where
346+ (<>) = append
347+#endif
348+
338349instance Monoid Text where
339350 mempty = empty
351+#if MIN_VERSION_base(4,9,0)
352+ mappend = (<>) -- future-proof definition
353+#else
340354 mappend = append
355+#endif
341356 mconcat = concat
342357
343358instance IsString Text where