Skip to content

Commit 15c4787

Browse files
committed
Even more Semigroup superclasses for old GHC
1 parent 269dcb0 commit 15c4787

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/Data/Patch/MapWithPatchingMove.hs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ deriving instance (Show k, Show p, Show (PatchTarget p)) => Show (PatchMapWithPa
4646
deriving instance (Ord k, Read k, Read p, Read (PatchTarget p)) => Read (PatchMapWithPatchingMove k p)
4747
deriving instance (Eq k, Eq p, Eq (PatchTarget p)) => Eq (PatchMapWithPatchingMove k p)
4848
deriving instance (Ord k, Ord p, Ord (PatchTarget p)) => Ord (PatchMapWithPatchingMove k p)
49-
deriving instance (Ord k, Monoid p, DecidablyEmpty p, Patch p) => DecidablyEmpty (PatchMapWithPatchingMove k p)
49+
50+
deriving instance ( Ord k
51+
#if !MIN_VERSION_base(4,11,0)
52+
, Semigroup p
53+
#endif
54+
, DecidablyEmpty p
55+
, Patch p
56+
) => DecidablyEmpty (PatchMapWithPatchingMove k p)
5057

5158
-- | Holds the information about each key: where its new value should come from,
5259
-- and where its old value should go to
@@ -129,7 +136,13 @@ insertMapKey k v = PatchMapWithPatchingMove . Map.singleton k $ NodeInfo (From_I
129136
-- 'Map.delete' src (maybe map ('Map.insert' dst) (Map.lookup src map))
130137
-- @
131138
moveMapKey
132-
:: (DecidablyEmpty p, Patch p) => Ord k => k -> k -> PatchMapWithPatchingMove k p
139+
:: ( DecidablyEmpty p
140+
#if !MIN_VERSION_base(4,11,0)
141+
, Semigroup p
142+
#endif
143+
, Patch p
144+
)
145+
=> Ord k => k -> k -> PatchMapWithPatchingMove k p
133146
moveMapKey src dst
134147
| src == dst = mempty
135148
| otherwise =
@@ -148,7 +161,12 @@ moveMapKey src dst
148161
-- . Map.delete a . Map.delete b $ map
149162
-- @
150163
swapMapKey
151-
:: (DecidablyEmpty p, Patch p)
164+
:: ( DecidablyEmpty p
165+
#if !MIN_VERSION_base(4,11,0)
166+
, Semigroup p
167+
#endif
168+
, Patch p
169+
)
152170
=> Ord k => k -> k -> PatchMapWithPatchingMove k p
153171
swapMapKey src dst
154172
| src == dst = mempty
@@ -290,7 +308,6 @@ instance ( Ord k
290308
#if !MIN_VERSION_base(4,11,0)
291309
, Semigroup p
292310
#endif
293-
, Monoid p
294311
, DecidablyEmpty p
295312
, Patch p
296313
) => Semigroup (PatchMapWithPatchingMove k p) where
@@ -352,7 +369,6 @@ instance ( Ord k
352369
#if !MIN_VERSION_base(4,11,0)
353370
, Semigroup p
354371
#endif
355-
, Monoid p
356372
, DecidablyEmpty p
357373
, Patch p
358374
) => Monoid (PatchMapWithPatchingMove k p) where

0 commit comments

Comments
 (0)