[commit: ghc] wip/simplcore-foldl: SimplCore: Use foldl' instead of foldr (e97c137)
git at git.haskell.org
git at git.haskell.org
Tue Mar 19 05:04:40 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/simplcore-foldl
Link : http://ghc.haskell.org/trac/ghc/changeset/e97c137449b782e6c06c98b409c84c1ec8666cd0/ghc
>---------------------------------------------------------------
commit e97c137449b782e6c06c98b409c84c1ec8666cd0
Author: Ben Gamari <ben at smart-cactus.org>
Date: Mon Mar 18 22:57:51 2019 -0400
SimplCore: Use foldl' instead of foldr
>---------------------------------------------------------------
e97c137449b782e6c06c98b409c84c1ec8666cd0
compiler/simplCore/SimplCore.hs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 7f2a0ea..ade9816 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -943,18 +943,18 @@ shortOutIndirections binds
makeIndEnv :: [CoreBind] -> IndEnv
makeIndEnv binds
- = foldr add_bind emptyVarEnv binds
+ = foldl' add_bind emptyVarEnv binds
where
- add_bind :: CoreBind -> IndEnv -> IndEnv
- add_bind (NonRec exported_id rhs) env = add_pair (exported_id, rhs) env
- add_bind (Rec pairs) env = foldr add_pair env pairs
+ add_bind :: IndEnv -> CoreBind -> IndEnv
+ add_bind env (NonRec exported_id rhs) = add_pair env (exported_id, rhs)
+ add_bind env (Rec pairs) = foldl' add_pair env pairs
- add_pair :: (Id,CoreExpr) -> IndEnv -> IndEnv
- add_pair (exported_id, exported) env
+ add_pair :: IndEnv -> (Id,CoreExpr) -> IndEnv
+ add_pair env (exported_id, exported)
| (ticks, Var local_id) <- stripTicksTop tickishFloatable exported
, shortMeOut env exported_id local_id
= extendVarEnv env local_id (exported_id, ticks)
- add_pair _ env = env
+ add_pair env _ = env
-----------------
shortMeOut :: IndEnv -> Id -> Id -> Bool
More information about the ghc-commits
mailing list