summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-03-18 22:57:51 -0400
committerBen Gamari <ben@smart-cactus.org>2019-03-18 22:58:32 -0400
commite97c137449b782e6c06c98b409c84c1ec8666cd0 (patch)
treef1665ff00073608d0be08c16f1667f8e5b714eb8
parent6113d0d4540af7853c71e9f42a41c3b0bab386fd (diff)
downloadhaskell-wip/simplcore-foldl.tar.gz
SimplCore: Use foldl' instead of foldrwip/simplcore-foldl
-rw-r--r--compiler/simplCore/SimplCore.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 7f2a0ea589..ade9816a1b 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