Skip to content

Commit 90702ae

Browse files
committed
Relax constraints on Semigroup and Monoid instances
1 parent cf586d7 commit 90702ae

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Data/HashMap/Internal.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ instance Bifoldable HashMap where
311311
--
312312
-- >>> fromList [(1,'a'),(2,'b')] <> fromList [(2,'c'),(3,'d')]
313313
-- fromList [(1,'a'),(2,'b'),(3,'d')]
314-
instance Hashable k => Semigroup (HashMap k v) where
314+
instance Eq k => Semigroup (HashMap k v) where
315315
(<>) = union
316316
{-# INLINE (<>) #-}
317317
stimes = stimesIdempotentMonoid
@@ -327,7 +327,7 @@ instance Hashable k => Semigroup (HashMap k v) where
327327
--
328328
-- >>> mappend (fromList [(1,'a'),(2,'b')]) (fromList [(2,'c'),(3,'d')])
329329
-- fromList [(1,'a'),(2,'b'),(3,'d')]
330-
instance Hashable k => Monoid (HashMap k v) where
330+
instance Eq k => Monoid (HashMap k v) where
331331
mempty = empty
332332
{-# INLINE mempty #-}
333333
mappend = (<>)

Data/HashSet/Internal.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ instance Foldable.Foldable HashSet where
187187
--
188188
-- >>> fromList [1,2] <> fromList [2,3]
189189
-- fromList [1,2,3]
190-
instance Hashable a => Semigroup (HashSet a) where
190+
instance Eq a => Semigroup (HashSet a) where
191191
(<>) = union
192192
{-# INLINE (<>) #-}
193193
stimes = stimesIdempotentMonoid
@@ -206,7 +206,7 @@ instance Hashable a => Semigroup (HashSet a) where
206206
--
207207
-- >>> mappend (fromList [1,2]) (fromList [2,3])
208208
-- fromList [1,2,3]
209-
instance Hashable a => Monoid (HashSet a) where
209+
instance Eq a => Monoid (HashSet a) where
210210
mempty = empty
211211
{-# INLINE mempty #-}
212212
mappend = (<>)

0 commit comments

Comments
 (0)