diff options
Diffstat (limited to 'compiler/simplCore')
-rw-r--r-- | compiler/simplCore/CallArity.hs | 3 | ||||
-rw-r--r-- | compiler/simplCore/FloatIn.hs | 6 | ||||
-rw-r--r-- | compiler/simplCore/SetLevels.hs | 18 |
3 files changed, 15 insertions, 12 deletions
diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs index e172aefcd7..2cf28a04e7 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/simplCore/CallArity.hs @@ -20,6 +20,7 @@ import CoreUtils ( exprIsHNF, exprIsTrivial ) import UnVarGraph import Demand +import Data.Foldable ( foldl' ) import Control.Arrow ( first, second ) @@ -725,4 +726,4 @@ lubArityEnv :: VarEnv Arity -> VarEnv Arity -> VarEnv Arity lubArityEnv = plusVarEnv_C min lubRess :: [CallArityRes] -> CallArityRes -lubRess = foldl lubRes emptyArityRes +lubRess = foldl' lubRes emptyArityRes diff --git a/compiler/simplCore/FloatIn.hs b/compiler/simplCore/FloatIn.hs index f32b5a387b..d315d649a6 100644 --- a/compiler/simplCore/FloatIn.hs +++ b/compiler/simplCore/FloatIn.hs @@ -30,7 +30,7 @@ import VarSet import Util import DynFlags import Outputable -import Data.List( mapAccumL ) +import Data.List ( mapAccumL, foldl' ) {- Top-level interface function, @floatInwards@. Note that we do not @@ -426,9 +426,9 @@ fiExpr dflags to_drop (_, AnnCase scrut case_bndr ty alts) alts_ty_fvs = map alt_ty_fvs alts all_alts_ty_fvs = unionDVarSets alts_ty_fvs alt_fvs (_con, args, rhs) - = foldl delDVarSet (freeVarsOf rhs) (case_bndr:args) + = foldl' delDVarSet (freeVarsOf rhs) (case_bndr:args) alt_ty_fvs (_con, args, rhs) - = foldl delDVarSet (freeVarsOfType rhs) (case_bndr:args) + = foldl' delDVarSet (freeVarsOfType rhs) (case_bndr:args) -- Delete case_bndr and args from free vars of rhs -- to get free vars of alt 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) } |