summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-01-11 21:12:42 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-05 19:09:27 -0500
commit441724e30d19e1abab4a9b04e270837bfb2c49e6 (patch)
treed21a3eb8caa04d7ec687f8a54fc0c7bf0e71a542
parenta5a5c7e039b5a6840da8a3b70cee078049aaa5b8 (diff)
downloadhaskell-441724e30d19e1abab4a9b04e270837bfb2c49e6.tar.gz
UnVarGraph: Use foldl' rather than foldr in unionUnVarSets
This is avoids pushing the entire list to the stack before we can begin computing the result.
-rw-r--r--compiler/GHC/Data/Graph/UnVar.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Data/Graph/UnVar.hs b/compiler/GHC/Data/Graph/UnVar.hs
index 4d1657ce62..3d6c805a20 100644
--- a/compiler/GHC/Data/Graph/UnVar.hs
+++ b/compiler/GHC/Data/Graph/UnVar.hs
@@ -74,7 +74,7 @@ unionUnVarSet :: UnVarSet -> UnVarSet -> UnVarSet
unionUnVarSet (UnVarSet set1) (UnVarSet set2) = UnVarSet (set1 `S.union` set2)
unionUnVarSets :: [UnVarSet] -> UnVarSet
-unionUnVarSets = foldr unionUnVarSet emptyUnVarSet
+unionUnVarSets = foldl' (flip unionUnVarSet) emptyUnVarSet
instance Outputable UnVarSet where
ppr (UnVarSet s) = braces $