[commit: packages/terminfo] master: Define missing Semigroup instance (19500c7)
git at git.haskell.org
git at git.haskell.org
Thu Dec 15 19:51:47 UTC 2016
Repository : ssh://git@git.haskell.org/terminfo
On branch : master
Link : http://git.haskell.org/packages/terminfo.git/commitdiff/19500c702f87680a5f143331286bd4755912ec05
>---------------------------------------------------------------
commit 19500c702f87680a5f143331286bd4755912ec05
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Fri Jan 1 10:05:03 2016 +0100
Define missing Semigroup instance
This makes `terminfo` `-Wcompat`-clean.
>---------------------------------------------------------------
19500c702f87680a5f143331286bd4755912ec05
System/Console/Terminfo/Base.hs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/System/Console/Terminfo/Base.hs b/System/Console/Terminfo/Base.hs
index d2b262c..a0042eb 100644
--- a/System/Console/Terminfo/Base.hs
+++ b/System/Console/Terminfo/Base.hs
@@ -45,7 +45,9 @@ module System.Console.Terminfo.Base(
import Control.Applicative
import Control.Monad
-#if !MIN_VERSION_base(4,8,0)
+#if MIN_VERSION_base(4,9,0)
+import Data.Semigroup
+#elif !MIN_VERSION_base(4,8,0)
import Data.Monoid
#endif
import Foreign.C
@@ -140,9 +142,18 @@ newtype TermOutput = TermOutput ([TermOutputType] -> [TermOutputType])
data TermOutputType = TOCmd LinesAffected String
| TOStr String
+#if MIN_VERSION_base(4,9,0)
+instance Semigroup TermOutput where
+ TermOutput xs <> TermOutput ys = TermOutput (xs . ys)
+
+instance Monoid TermOutput where
+ mempty = TermOutput id
+ mappend = (<>)
+#else
instance Monoid TermOutput where
mempty = TermOutput id
TermOutput xs `mappend` TermOutput ys = TermOutput (xs . ys)
+#endif
termText :: String -> TermOutput
termText str = TermOutput (TOStr str :)
More information about the ghc-commits
mailing list