[Git][ghc/ghc][wip/sjakobi/nondetfolds] Improve udfmToUfm

Simon Jakobi gitlab at gitlab.haskell.org
Tue Mar 31 02:11:17 UTC 2020



Simon Jakobi pushed to branch wip/sjakobi/nondetfolds at Glasgow Haskell Compiler / GHC


Commits:
cb538d30 by Simon Jakobi at 2020-03-31T04:10:58+02:00
Improve udfmToUfm

- - - - -


1 changed file:

- compiler/GHC/Types/Unique/DFM.hs


Changes:

=====================================
compiler/GHC/Types/Unique/DFM.hs
=====================================
@@ -73,7 +73,7 @@ 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, listToUFM_Directly, nonDetUFMToList, ufmToIntMap, intMapToUFM)
+import GHC.Types.Unique.FM (UniqFM, nonDetUFMToList, ufmToIntMap, intMapToUFM)
 
 -- Note [Deterministic UniqFM]
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -358,8 +358,7 @@ delListFromUDFM = foldl' delFromUDFM
 
 -- | This allows for lossy conversion from UniqDFM to UniqFM
 udfmToUfm :: UniqDFM elt -> UniqFM elt
-udfmToUfm (UDFM m _i) =
-  listToUFM_Directly [(getUnique k, taggedFst tv) | (k, tv) <- M.toList m] -- TODO
+udfmToUfm (UDFM m _i) = intMapToUFM (M.map taggedFst m)
 
 listToUDFM :: Uniquable key => [(key,elt)] -> UniqDFM elt
 listToUDFM = foldl' (\m (k, v) -> addToUDFM m k v) emptyUDFM



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cb538d30d9f8d774064406bf8748799d2f1ad775

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cb538d30d9f8d774064406bf8748799d2f1ad775
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200330/e88240a6/attachment.html>


More information about the ghc-commits mailing list