summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreSubst.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/coreSyn/CoreSubst.hs
parente996e85f003e783fc8f9af0da653cdd0058d9646 (diff)
downloadhaskell-wip/foldl.tar.gz
Use strict foldlswip/foldl
Diffstat (limited to 'compiler/coreSyn/CoreSubst.hs')
-rw-r--r--compiler/coreSyn/CoreSubst.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs
index 1f60e7cd1f..8bc9cb6197 100644
--- a/compiler/coreSyn/CoreSubst.hs
+++ b/compiler/coreSyn/CoreSubst.hs
@@ -7,6 +7,7 @@ Utility functions on @Core@ syntax
-}
{-# LANGUAGE CPP #-}
+{-# LANGUAGE BangPatterns #-}
module CoreSubst (
-- * Main data types
Subst(..), -- Implementation exported for supercompiler's Renaming.hs only
@@ -898,9 +899,9 @@ simpleOptPgm dflags this_mod binds rules vects
where
occ_anald_binds = occurAnalysePgm this_mod (\_ -> False) {- No rules active -}
rules vects emptyVarEnv binds
- (subst', binds') = foldl do_one (emptySubst, []) occ_anald_binds
+ (subst', binds') = foldl' do_one (emptySubst, []) occ_anald_binds
- do_one (subst, binds') bind
+ do_one (!subst, !binds') bind
= case simple_opt_bind subst bind of
(subst', Nothing) -> (subst', binds')
(subst', Just bind') -> (subst', bind':binds')
@@ -1006,7 +1007,7 @@ simple_app subst (Tick t e) as
| t `tickishScopesLike` SoftScope
= mkTick t $ simple_app subst e as
simple_app subst e as
- = foldl App (simple_opt_expr subst e) as
+ = foldl' App (simple_opt_expr subst e) as
----------------------
simple_opt_bind,simple_opt_bind' :: Subst -> CoreBind -> (Subst, Maybe CoreBind)
@@ -1018,8 +1019,8 @@ simple_opt_bind' subst (Rec prs)
where
res_bind = Just (Rec (reverse rev_prs'))
(subst', bndrs') = subst_opt_bndrs subst (map fst prs)
- (subst'', rev_prs') = foldl do_pr (subst', []) (prs `zip` bndrs')
- do_pr (subst, prs) ((b,r), b')
+ (subst'', rev_prs') = foldl' do_pr (subst', []) (prs `zip` bndrs')
+ do_pr (!subst, !prs) ((b,r), b')
= case maybe_substitute subst b r2 of
Just subst' -> (subst', prs)
Nothing -> (subst, (b2,r2):prs)