diff options
author | David Feuer <david.feuer@gmail.com> | 2018-03-19 12:03:36 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-03-19 12:05:12 -0400 |
commit | fbd9b886df92d1e0be0bdaacc7352273b504b78d (patch) | |
tree | d78e2124d644c4fe51f0b1c42631ba8a78111133 /compiler/utils/UniqFM.hs | |
parent | 256577fbde836f13c744418d38d18c17a369f7e9 (diff) | |
download | haskell-fbd9b886df92d1e0be0bdaacc7352273b504b78d.tar.gz |
Implement equalKeysUFM the right way
Originally, we compared the key lists, which was kind of silly.
Then I changed it to something fancier ... and also silly.
This is much more reasonable, should be faster, and is nice and
clear.
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4500
Diffstat (limited to 'compiler/utils/UniqFM.hs')
-rw-r--r-- | compiler/utils/UniqFM.hs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index 2a9b806178..a80880f4e5 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -78,12 +78,10 @@ import Outputable import Data.List (foldl') import qualified Data.IntMap as M -import qualified Data.IntMap.Merge.Lazy as M -import Control.Applicative (Const (..)) -import qualified Data.Monoid as Mon import qualified Data.IntSet as S import Data.Data import qualified Data.Semigroup as Semi +import Data.Functor.Classes (Eq1 (..)) newtype UniqFM ele = UFM (M.IntMap ele) @@ -342,10 +340,7 @@ ufmToIntMap (UFM m) = m -- Determines whether two 'UniqFm's contain the same keys. equalKeysUFM :: UniqFM a -> UniqFM b -> Bool -equalKeysUFM (UFM m1) (UFM m2) = Mon.getAll $ getConst $ - M.mergeA (M.traverseMissing (\_ _ -> Const (Mon.All False))) - (M.traverseMissing (\_ _ -> Const (Mon.All False))) - (M.zipWithAMatched (\_ _ _ -> Const (Mon.All True))) m1 m2 +equalKeysUFM (UFM m1) (UFM m2) = liftEq (\_ _ -> True) m1 m2 -- Instances |