diff options
author | Richard Lupton <richard.lupton@gmail.com> | 2019-08-17 13:34:51 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-08-19 02:12:00 -0400 |
commit | ac79dfe9cb51f38e122af9a404d50aead8a9e8b0 (patch) | |
tree | ed4b2acdc3f5613460ee0cffbec4f71bc1df518e /compiler/specialise | |
parent | 2a394246da84c17e1b5103bde320b8ca4ce1158a (diff) | |
download | haskell-ac79dfe9cb51f38e122af9a404d50aead8a9e8b0.tar.gz |
Remove Bag fold specialisations (#16969)
Diffstat (limited to 'compiler/specialise')
-rw-r--r-- | compiler/specialise/Specialise.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 3434172de2..e49a40dc0d 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -2181,7 +2181,7 @@ callDetailsFVs calls = callInfoFVs :: CallInfoSet -> VarSet callInfoFVs (CIS _ call_info) = - foldrBag (\(CI { ci_fvs = fv }) vs -> unionVarSet fv vs) emptyVarSet call_info + foldr (\(CI { ci_fvs = fv }) vs -> unionVarSet fv vs) emptyVarSet call_info computeArity :: [SpecArg] -> Int computeArity = length . filter isValueArg . dropWhileEndLE isUnspecArg @@ -2350,7 +2350,7 @@ plusUDs (MkUD {ud_binds = db1, ud_calls = calls1}) ----------------------------- _dictBindBndrs :: Bag DictBind -> [Id] -_dictBindBndrs dbs = foldrBag ((++) . bindersOf . fst) [] dbs +_dictBindBndrs dbs = foldr ((++) . bindersOf . fst) [] dbs -- | Construct a 'DictBind' from a 'CoreBind' mkDB :: CoreBind -> DictBind @@ -2389,7 +2389,7 @@ recWithDumpedDicts :: [(Id,CoreExpr)] -> Bag DictBind ->DictBind recWithDumpedDicts pairs dbs = (Rec bindings, fvs) where - (bindings, fvs) = foldrBag add + (bindings, fvs) = foldr add ([], emptyVarSet) (dbs `snocBag` mkDB (Rec pairs)) add (NonRec b r, fvs') (pairs, fvs) = @@ -2413,13 +2413,13 @@ snocDictBind uds bind = uds { ud_binds = ud_binds uds `snocBag` bind } wrapDictBinds :: Bag DictBind -> [CoreBind] -> [CoreBind] wrapDictBinds dbs binds - = foldrBag add binds dbs + = foldr add binds dbs where add (bind,_) binds = bind : binds wrapDictBindsE :: Bag DictBind -> CoreExpr -> CoreExpr wrapDictBindsE dbs expr - = foldrBag add expr dbs + = foldr add expr dbs where add (bind,_) expr = Let bind expr @@ -2478,7 +2478,7 @@ filterCalls :: CallInfoSet -> Bag DictBind -> [CallInfo] filterCalls (CIS fn call_bag) dbs = filter ok_call (bagToList call_bag) where - dump_set = foldlBag go (unitVarSet fn) dbs + dump_set = foldl' go (unitVarSet fn) dbs -- This dump-set could also be computed by splitDictBinds -- (_,_,dump_set) = splitDictBinds dbs {fn} -- But this variant is shorter @@ -2498,8 +2498,8 @@ splitDictBinds :: Bag DictBind -> IdSet -> (Bag DictBind, Bag DictBind, IdSet) -- * free_dbs does not depend on bndrs -- * dump_set = bndrs `union` bndrs(dump_dbs) splitDictBinds dbs bndr_set - = foldlBag split_db (emptyBag, emptyBag, bndr_set) dbs - -- Important that it's foldl not foldr; + = foldl' split_db (emptyBag, emptyBag, bndr_set) dbs + -- Important that it's foldl' not foldr; -- we're accumulating the set of dumped ids in dump_set where split_db (free_dbs, dump_dbs, dump_idset) db@(bind, fvs) |