summaryrefslogtreecommitdiff
path: root/compiler/simplCore/SetLevels.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-05-10 11:57:02 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-12 15:16:07 +0200
commitba46dd060f959e3c96a74c1546946c3f8bf84dd0 (patch)
treefaa22032f485d0222bb102645971dd82e76236c2 /compiler/simplCore/SetLevels.hs
parente996e85f003e783fc8f9af0da653cdd0058d9646 (diff)
downloadhaskell-wip/foldl.tar.gz
Use strict foldlswip/foldl
Diffstat (limited to 'compiler/simplCore/SetLevels.hs')
-rw-r--r--compiler/simplCore/SetLevels.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs
index 86442ab54b..c62bf4bf6c 100644
--- a/compiler/simplCore/SetLevels.hs
+++ b/compiler/simplCore/SetLevels.hs
@@ -87,6 +87,8 @@ import FastString
import UniqDFM (udfmToUfm)
import FV
+import Data.Foldable ( foldl' )
+
{-
************************************************************************
* *
@@ -312,7 +314,7 @@ lvlExpr env expr@(_, AnnApp _ _) = do
let (lapp, rargs) = left (n_val_args - arity) expr []
rargs' <- mapM (lvlMFE False env) rargs
lapp' <- lvlMFE False env lapp
- return (foldl App lapp' rargs')
+ return (foldl' App lapp' rargs')
where
n_val_args = count (isValArg . deAnnotate) args
arity = idArity f
@@ -331,7 +333,7 @@ lvlExpr env expr@(_, AnnApp _ _) = do
_otherwise -> do
args' <- mapM (lvlMFE False env) args
fun' <- lvlExpr env fun
- return (foldl App fun' args')
+ return (foldl' App fun' args')
-- We don't split adjacent lambdas. That is, given
-- \x y -> (x+1,y)
@@ -833,7 +835,7 @@ substBndrsSL :: RecFlag -> LevelEnv -> [InVar] -> (LevelEnv, [OutVar])
-- So named only to avoid the name clash with CoreSubst.substBndrs
substBndrsSL is_rec env@(LE { le_subst = subst, le_env = id_env }) bndrs
= ( env { le_subst = subst'
- , le_env = foldl add_id id_env (bndrs `zip` bndrs') }
+ , le_env = foldl' add_id id_env (bndrs `zip` bndrs') }
, bndrs')
where
(subst', bndrs') = case is_rec of
@@ -973,7 +975,7 @@ addLvl :: Level -> VarEnv Level -> OutVar -> VarEnv Level
addLvl dest_lvl env v' = extendVarEnv env v' dest_lvl
addLvls :: Level -> VarEnv Level -> [OutVar] -> VarEnv Level
-addLvls dest_lvl env vs = foldl (addLvl dest_lvl) env vs
+addLvls dest_lvl env vs = foldl' (addLvl dest_lvl) env vs
floatLams :: LevelEnv -> Maybe Int
floatLams le = floatOutLambdas (le_switches le)
@@ -1080,8 +1082,8 @@ newPolyBndrs dest_lvl
; let new_bndrs = zipWith mk_poly_bndr bndrs uniqs
bndr_prs = bndrs `zip` new_bndrs
env' = env { le_lvl_env = addLvls dest_lvl lvl_env new_bndrs
- , le_subst = foldl add_subst subst bndr_prs
- , le_env = foldl add_id id_env bndr_prs }
+ , le_subst = foldl' add_subst subst bndr_prs
+ , le_env = foldl' add_id id_env bndr_prs }
; return (env', new_bndrs) }
where
add_subst env (v, v') = extendIdSubst env v (mkVarApps (Var v') abs_vars)
@@ -1116,7 +1118,7 @@ cloneCaseBndrs env@(LE { le_subst = subst, le_lvl_env = lvl_env, le_env = id_env
env' = env { le_ctxt_lvl = new_lvl
, le_lvl_env = addLvls new_lvl lvl_env vs'
, le_subst = subst'
- , le_env = foldl add_id id_env (vs `zip` vs') }
+ , le_env = foldl' add_id id_env (vs `zip` vs') }
; return (env', vs') }
@@ -1136,7 +1138,7 @@ cloneLetVars is_rec
prs = vs `zip` vs2
env' = env { le_lvl_env = addLvls dest_lvl lvl_env vs2
, le_subst = subst'
- , le_env = foldl add_id id_env prs }
+ , le_env = foldl' add_id id_env prs }
; return (env', vs2) }