[Git][ghc/ghc][wip/sjakobi/foldl-unionManyUniqDSets] Use foldl' in unionManyUniqDSets

Simon Jakobi gitlab at gitlab.haskell.org
Sat Apr 4 23:57:59 UTC 2020



Simon Jakobi pushed to branch wip/sjakobi/foldl-unionManyUniqDSets at Glasgow Haskell Compiler / GHC


Commits:
32b6005d by Simon Jakobi at 2020-04-05T01:56:55+02:00
Use foldl' in unionManyUniqDSets

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/Types/Unique/DSet.hs
=====================================
@@ -81,8 +81,8 @@ unionUniqDSets :: UniqDSet a -> UniqDSet a -> UniqDSet a
 unionUniqDSets (UniqDSet s) (UniqDSet t) = UniqDSet (plusUDFM s t)
 
 unionManyUniqDSets :: [UniqDSet a] -> UniqDSet a
-unionManyUniqDSets [] = emptyUniqDSet
-unionManyUniqDSets sets = foldr1 unionUniqDSets sets
+unionManyUniqDSets []     = emptyUniqDSet
+unionManyUniqDSets (x:xs) = foldl' unionUniqDSets x xs
 
 minusUniqDSet :: UniqDSet a -> UniqDSet a -> UniqDSet a
 minusUniqDSet (UniqDSet s) (UniqDSet t) = UniqDSet (minusUDFM s t)



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/32b6005dd052b02313d00e7824ca3ed2e70d8085
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/20200404/bbc9670f/attachment-0001.html>


More information about the ghc-commits mailing list