[commit: ghc] master: Replace some `length . filter` with `count` (02614fd)
git at git.haskell.org
git at git.haskell.org
Fri Aug 5 22:41:42 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/02614fd61f57b599c5e4fd5e85f00a4e1ce37bc7/ghc
>---------------------------------------------------------------
commit 02614fd61f57b599c5e4fd5e85f00a4e1ce37bc7
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Fri Aug 5 20:58:02 2016 +0000
Replace some `length . filter` with `count`
>---------------------------------------------------------------
02614fd61f57b599c5e4fd5e85f00a4e1ce37bc7
compiler/coreSyn/CoreSubst.hs | 2 +-
compiler/simplCore/SAT.hs | 2 +-
compiler/typecheck/TcExpr.hs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs
index 7723b71..ffd8c2a 100644
--- a/compiler/coreSyn/CoreSubst.hs
+++ b/compiler/coreSyn/CoreSubst.hs
@@ -1434,7 +1434,7 @@ exprIsLambda_maybe (in_scope_set, id_unf) (Cast casted_e co)
-- Another attempt: See if we find a partial unfolding
exprIsLambda_maybe (in_scope_set, id_unf) e
| (Var f, as, ts) <- collectArgsTicks tickishFloatable e
- , idArity f > length (filter isValArg as)
+ , idArity f > count isValArg as
-- Make sure there is hope to get a lambda
, Just rhs <- expandUnfolding_maybe (id_unf f)
-- Optimize, for beta-reduction
diff --git a/compiler/simplCore/SAT.hs b/compiler/simplCore/SAT.hs
index 38ae144..923d3a4 100644
--- a/compiler/simplCore/SAT.hs
+++ b/compiler/simplCore/SAT.hs
@@ -373,7 +373,7 @@ saTransformMaybe binder maybe_arg_staticness rhs_binders rhs_body
where
should_transform staticness = n_static_args > 1 -- THIS IS THE DECISION POINT
where
- n_static_args = length (filter isStaticValue staticness)
+ n_static_args = count isStaticValue staticness
saTransform :: Id -> SATInfo -> [Id] -> CoreExpr -> SatM CoreBind
saTransform binder arg_staticness rhs_binders rhs_body
diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs
index 54d0254..dc1a90f 100644
--- a/compiler/typecheck/TcExpr.hs
+++ b/compiler/typecheck/TcExpr.hs
@@ -2455,7 +2455,7 @@ badFieldsUpd rbinds data_cons
sortBy (compare `on` fst) .
map (\ item@(_, membershipRow) -> (countTrue membershipRow, item))
- countTrue = length . filter id
+ countTrue = count id
{-
Note [Finding the conflicting fields]
More information about the ghc-commits
mailing list