From 8631ccf2ad221dfc04b66d1ad137bf4057dd2c06 Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski Date: Wed, 28 Jul 2021 21:27:57 +0200 Subject: 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. --- compiler/GHC/Types/Unique/DFM.hs | 8 -------- compiler/GHC/Types/Unique/DSet.hs | 4 +--- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'compiler') 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 -- cgit v1.2.1