From 017e1bd2b8b343dd2c17500865c3c8f5570ebf73 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Tue, 24 Apr 2018 22:40:12 +0200 Subject: [PATCH] Add Semigroup instances for GHC 8.4.2 --- src/Yi/Rope.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Yi/Rope.hs b/src/Yi/Rope.hs index a87ebbc..a6961c0 100644 --- a/src/Yi/Rope.hs +++ b/src/Yi/Rope.hs @@ -1,3 +1,4 @@ +{-# language CPP #-} {-# language BangPatterns #-} {-# language DeriveDataTypeable #-} {-# language LambdaCase #-} @@ -115,6 +116,11 @@ overChunk f (Chunk l t) = Chunk l (f t) countNl :: TX.Text -> Int countNl = TX.count "\n" +#if __GLASGOW_HASKELL__ >= 804 +instance Semigroup Size where + (<>) = mappend +#endif + instance Monoid Size where mempty = Indices 0 0 Indices c l `mappend` Indices c' l' = Indices (c + c') (l + l') @@ -153,6 +159,11 @@ instance NFData YiString where instance IsString YiString where fromString = Yi.Rope.fromString +#if __GLASGOW_HASKELL__ >= 804 +instance Semigroup YiString where + (<>) = mappend +#endif + instance Monoid YiString where mempty = Yi.Rope.empty mappend = Yi.Rope.append