@@ -1,140 +0,0 @@
1−From a08f6e400772899b9b0fc16befc50391cd70696b Mon Sep 17 00:00:00 2001
2−From: Felix Yan <felixonmars@archlinux.org>
3−Date: Fri, 18 May 2018 16:24:41 +0800
4−Subject: [PATCH] GHC 8.4 support
5−
6−---
7− src/Extension/Data/Bounded.hs | 10 ++++-
8− src/Extension/Data/Monoid.hs | 14 +++---
9− src/Logic/Connectives.hs | 4 +-
10− src/Text/PrettyPrint/Class.hs | 4 +-
11− src/Text/PrettyPrint/Html.hs | 6 ++-
12− 11 files changed, 79 insertions(+), 48 deletions(-)
13−
14−
15−diff --git a/src/Extension/Data/Bounded.hs b/src/Extension/Data/Bounded.hs
16−index 5f166006..f416a44c 100644
17−--- a/src/Extension/Data/Bounded.hs
18−+++ b/src/Extension/Data/Bounded.hs
19−@@ -11,19 +11,25 @@ module Extension.Data.Bounded (
20− ) where
21−
22− -- import Data.Monoid
23−+import Data.Semigroup
24−
25− -- | A newtype wrapper for a monoid of the maximum of a bounded type.
26− newtype BoundedMax a = BoundedMax {getBoundedMax :: a}
27− deriving( Eq, Ord, Show )
28−
29−+instance (Ord a, Bounded a) => Semigroup (BoundedMax a) where
30−+ BoundedMax x <> BoundedMax y = BoundedMax (max x y)
31−+
32− instance (Ord a, Bounded a) => Monoid (BoundedMax a) where
33− mempty = BoundedMax minBound
34−- (BoundedMax x) `mappend` (BoundedMax y) = BoundedMax (max x y)
35−+ mappend = (<>)
36−
37− -- | A newtype wrapper for a monoid of the minimum of a bounded type.
38− newtype BoundedMin a = BoundedMin {getBoundedMin :: a}
39− deriving( Eq, Ord, Show )
40−
41−+instance (Ord a, Bounded a) => Semigroup (BoundedMin a) where
42−+ BoundedMin x <> BoundedMin y = BoundedMin (min x y)
43−+
44− instance (Ord a, Bounded a) => Monoid (BoundedMin a) where
45− mempty = BoundedMin maxBound
46−- (BoundedMin x) `mappend` (BoundedMin y) = BoundedMin (min x y)
47−\ No newline at end of file
48−diff --git a/src/Extension/Data/Monoid.hs b/src/Extension/Data/Monoid.hs
49−index 83655c34..9ce2f91b 100644
50−--- a/src/Extension/Data/Monoid.hs
51−+++ b/src/Extension/Data/Monoid.hs
52−@@ -18,6 +18,7 @@ module Extension.Data.Monoid (
53− ) where
54−
55− import Data.Monoid
56−+import Data.Semigroup
57−
58− #if __GLASGOW_HASKELL__ < 704
59−
60−@@ -38,10 +39,13 @@ newtype MinMax a = MinMax { getMinMax :: Maybe (a, a) }
61− minMaxSingleton :: a -> MinMax a
62− minMaxSingleton x = MinMax (Just (x, x))
63−
64−+instance Ord a => Semigroup (MinMax a) where
65−+ MinMax Nothing <> y = y
66−+ x <> MinMax Nothing = x
67−+ MinMax (Just (xMin, xMax)) <> MinMax (Just (yMin, yMax)) =
68−+ MinMax (Just (min xMin yMin, max xMax yMax))
69−+
70−+
71− instance Ord a => Monoid (MinMax a) where
72− mempty = MinMax Nothing
73−-
74−- MinMax Nothing `mappend` y = y
75−- x `mappend` MinMax Nothing = x
76−- MinMax (Just (xMin, xMax)) `mappend` MinMax (Just (yMin, yMax)) =
77−- MinMax (Just (min xMin yMin, max xMax yMax))
78−+ mappend = (<>)
79−diff --git a/src/Logic/Connectives.hs b/src/Logic/Connectives.hs
80−index 2e441172..7206cc2c 100644
81−--- a/src/Logic/Connectives.hs
82−+++ b/src/Logic/Connectives.hs
83−@@ -23,12 +23,12 @@ import Control.DeepSeq
84−
85− -- | A conjunction of atoms of type a.
86− newtype Conj a = Conj { getConj :: [a] }
87−- deriving (Monoid, Foldable, Traversable, Eq, Ord, Show, Binary,
88−+ deriving (Monoid, Semigroup, Foldable, Traversable, Eq, Ord, Show, Binary,
89− Functor, Applicative, Monad, Alternative, MonadPlus, Typeable, Data, NFData)
90−
91− -- | A disjunction of atoms of type a.
92− newtype Disj a = Disj { getDisj :: [a] }
93−- deriving (Monoid, Foldable, Traversable, Eq, Ord, Show, Binary,
94−+ deriving (Monoid, Semigroup, Foldable, Traversable, Eq, Ord, Show, Binary,
95− Functor, Applicative, Monad, Alternative, MonadPlus, Typeable, Data, NFData)
96−
97− instance MonadDisj Disj where
98−diff --git a/src/Text/PrettyPrint/Class.hs b/src/Text/PrettyPrint/Class.hs
99−index f5eb42fe..13be6515 100644
100−--- a/src/Text/PrettyPrint/Class.hs
101−+++ b/src/Text/PrettyPrint/Class.hs
102−@@ -187,9 +187,11 @@ instance Document Doc where
103− nest i (Doc d) = Doc $ P.nest i d
104− caseEmptyDoc yes no (Doc d) = if P.isEmpty d then yes else no
105−
106−+instance Semigroup Doc where
107−+ Doc d1 <> Doc d2 = Doc $ (P.<>) d1 d2
108−+
109− instance Monoid Doc where
110− mempty = Doc $ P.empty
111−- mappend (Doc d1) (Doc d2) = Doc $ (P.<>) d1 d2
112−
113− ------------------------------------------------------------------------------
114− -- Additional combinators
115−diff --git a/src/Text/PrettyPrint/Html.hs b/src/Text/PrettyPrint/Html.hs
116−index 3de5e307..10103eb7 100644
117−--- a/src/Text/PrettyPrint/Html.hs
118−+++ b/src/Text/PrettyPrint/Html.hs
119−@@ -90,7 +90,7 @@ attribute (key,value) = " " ++ key ++ "=\"" ++ escapeHtmlEntities value ++ "\""
120−
121− -- | A 'Document' transformer that adds proper HTML escaping.
122− newtype HtmlDoc d = HtmlDoc { getHtmlDoc :: d }
123−- deriving( Monoid )
124−+ deriving( Monoid, Semigroup )
125−
126− -- | Wrap a document such that HTML markup can be added without disturbing the
127− -- layout.
128−@@ -182,9 +182,11 @@ getNoHtmlDoc = runIdentity . unNoHtmlDoc
129− instance NFData d => NFData (NoHtmlDoc d) where
130− rnf = rnf . getNoHtmlDoc
131−
132−+instance Semigroup d => Semigroup (NoHtmlDoc d) where
133−+ (<>) = liftA2 (<>)
134−+
135− instance Monoid d => Monoid (NoHtmlDoc d) where
136− mempty = pure mempty
137−- mappend = liftA2 mappend
138−
139− instance Document d => Document (NoHtmlDoc d) where
140− char = pure . char