summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-07-28 21:27:57 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-02 04:16:51 -0400
commit8631ccf2ad221dfc04b66d1ad137bf4057dd2c06 (patch)
tree0201b557281b045bf07eb2c877a9ea9bc6b58df9
parent3e93a3708ae2d5f58ce68b30323bb8d76b2fc0e9 (diff)
downloadhaskell-8631ccf2ad221dfc04b66d1ad137bf4057dd2c06.tar.gz
Remove Semigroup instance for UniqDFM (#19654)
The (<>) operator was not associative. Fortunately, the instance is not used anywhere, except to derive another unused instance for UniqDSet.
-rw-r--r--compiler/GHC/Types/Unique/DFM.hs8
-rw-r--r--compiler/GHC/Types/Unique/DSet.hs4
2 files changed, 1 insertions, 11 deletions
diff --git a/compiler/GHC/Types/Unique/DFM.hs b/compiler/GHC/Types/Unique/DFM.hs
index f3009de2a2..f143af2b58 100644
--- a/compiler/GHC/Types/Unique/DFM.hs
+++ b/compiler/GHC/Types/Unique/DFM.hs
@@ -77,7 +77,6 @@ import Data.Data
import Data.Functor.Classes (Eq1 (..))
import Data.List (sortBy)
import Data.Function (on)
-import qualified Data.Semigroup as Semi
import GHC.Types.Unique.FM (UniqFM, nonDetUFMToList, ufmToIntMap, unsafeIntMapToUFM)
import Unsafe.Coerce
@@ -412,13 +411,6 @@ anyUDFM p (UDFM m _i) = M.foldr ((||) . p . taggedFst) False m
allUDFM :: (elt -> Bool) -> UniqDFM key elt -> Bool
allUDFM p (UDFM m _i) = M.foldr ((&&) . p . taggedFst) True m
-instance Semi.Semigroup (UniqDFM key a) where
- (<>) = plusUDFM
-
-instance Monoid (UniqDFM key a) where
- mempty = emptyUDFM
- mappend = (Semi.<>)
-
-- This should not be used in committed code, provided for convenience to
-- make ad-hoc conversions when developing
alwaysUnsafeUfmToUdfm :: UniqFM key elt -> UniqDFM key elt
diff --git a/compiler/GHC/Types/Unique/DSet.hs b/compiler/GHC/Types/Unique/DSet.hs
index 0ce46ab083..d4d555f83b 100644
--- a/compiler/GHC/Types/Unique/DSet.hs
+++ b/compiler/GHC/Types/Unique/DSet.hs
@@ -8,7 +8,6 @@
--
-- Basically, the things need to be in class 'Uniquable'.
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
module GHC.Types.Unique.DSet (
@@ -46,14 +45,13 @@ import GHC.Types.Unique
import Data.Coerce
import Data.Data
-import qualified Data.Semigroup as Semi
-- See Note [UniqSet invariant] in GHC.Types.Unique.Set for why we want a newtype here.
-- Beyond preserving invariants, we may also want to 'override' typeclass
-- instances.
newtype UniqDSet a = UniqDSet {getUniqDSet' :: UniqDFM a a}
- deriving (Data, Semi.Semigroup, Monoid)
+ deriving (Data)
emptyUniqDSet :: UniqDSet a
emptyUniqDSet = UniqDSet emptyUDFM