Skip to content

Commit 70b5b9e

Browse files
authored
Guard redundant mappend definitions with CPP (#1142)
This is motivated by the proposed removal of mappend from Monoid in the final phase of the Semigroup-Monoid proposal. We cannot remove mappend references completely yet because we support base-4.10 which is pre-Semigroup-Monoid.
1 parent 3e619ce commit 70b5b9e

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

containers/src/Data/IntMap/Internal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ infixl 9 !?,\\{-This comment teaches CPP correct behaviour -}
447447
instance Monoid (IntMap a) where
448448
mempty = empty
449449
mconcat = unions
450+
#if !MIN_VERSION_base(4,11,0)
450451
mappend = (<>)
452+
#endif
451453

452454
-- | @(<>)@ = 'union'
453455
--

containers/src/Data/IntSet/Internal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,9 @@ deriving instance Lift IntSet
315315
instance Monoid IntSet where
316316
mempty = empty
317317
mconcat = unions
318+
#if !MIN_VERSION_base(4,11,0)
318319
mappend = (<>)
320+
#endif
319321

320322
-- | @(<>)@ = 'union'
321323
--

containers/src/Data/Map/Internal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ deriving instance (Lift k, Lift a) => Lift (Map k a)
488488
instance (Ord k) => Monoid (Map k v) where
489489
mempty = empty
490490
mconcat = unions
491+
#if !MIN_VERSION_base(4,11,0)
491492
mappend = (<>)
493+
#endif
492494

493495
-- | @(<>)@ = 'union'
494496
--

containers/src/Data/Sequence/Internal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,9 @@ instance Read1 Seq where
10011001
-- | @mempty@ = 'empty'
10021002
instance Monoid (Seq a) where
10031003
mempty = empty
1004+
#if !MIN_VERSION_base(4,11,0)
10041005
mappend = (Semigroup.<>)
1006+
#endif
10051007

10061008
-- | @(<>)@ = '(><)'
10071009
--

containers/src/Data/Set/Internal.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ deriving instance Lift a => Lift (Set a)
293293
instance Ord a => Monoid (Set a) where
294294
mempty = empty
295295
mconcat = unions
296+
#if !MIN_VERSION_base(4,11,0)
296297
mappend = (<>)
298+
#endif
297299

298300
-- | @(<>)@ = 'union'
299301
--
@@ -2099,8 +2101,9 @@ instance Semigroup (MergeSet a) where
20992101

21002102
instance Monoid (MergeSet a) where
21012103
mempty = MergeSet empty
2102-
2104+
#if !MIN_VERSION_base(4,11,0)
21032105
mappend = (<>)
2106+
#endif
21042107

21052108
-- | \(O(n+m)\). Calculate the disjoint union of two sets.
21062109
--

0 commit comments

Comments
 (0)