projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
44a1964
)
Monadify simplCore/SimplCore: use do, return and standard monad functions
author
Twan van Laarhoven
<twanvl@gmail.com>
Thu, 17 Jan 2008 19:51:49 +0000
(19:51 +0000)
committer
Twan van Laarhoven
<twanvl@gmail.com>
Thu, 17 Jan 2008 19:51:49 +0000
(19:51 +0000)
compiler/simplCore/SimplCore.lhs
patch
|
blob
|
history
diff --git
a/compiler/simplCore/SimplCore.lhs
b/compiler/simplCore/SimplCore.lhs
index
c7b2e69
..
bb9020d
100644
(file)
--- a/
compiler/simplCore/SimplCore.lhs
+++ b/
compiler/simplCore/SimplCore.lhs
@@
-244,7
+244,7
@@
prepareRules hsc_env@(HscEnv { hsc_dflags = dflags, hsc_HPT = hpt })
local_ids = mkInScopeSet (mkVarSet (bindersOfBinds binds))
env = setInScopeSet gentleSimplEnv local_ids
(better_rules,_) = initSmpl dflags emptyRuleBase emptyFamInstEnvs us $
local_ids = mkInScopeSet (mkVarSet (bindersOfBinds binds))
env = setInScopeSet gentleSimplEnv local_ids
(better_rules,_) = initSmpl dflags emptyRuleBase emptyFamInstEnvs us $
- (mapSmpl (simplRule env) local_rules)
+ (mapM (simplRule env) local_rules)
home_pkg_rules = hptRules hsc_env (dep_mods deps)
-- Find the rules for locally-defined Ids; then we can attach them
home_pkg_rules = hptRules hsc_env (dep_mods deps)
-- Find the rules for locally-defined Ids; then we can attach them
@@
-301,12
+301,12
@@
This doesn't match unless you do eta reduction on the build argument.
\begin{code}
simplRule env rule@(BuiltinRule {})
\begin{code}
simplRule env rule@(BuiltinRule {})
- = returnSmpl rule
+ = return rule
simplRule env rule@(Rule { ru_bndrs = bndrs, ru_args = args, ru_rhs = rhs })
simplRule env rule@(Rule { ru_bndrs = bndrs, ru_args = args, ru_rhs = rhs })
- = simplBinders env bndrs `thenSmpl` \ (env, bndrs') ->
- mapSmpl (simplExprGently env) args `thenSmpl` \ args' ->
- simplExprGently env rhs `thenSmpl` \ rhs' ->
- returnSmpl (rule { ru_bndrs = bndrs', ru_args = args', ru_rhs = rhs' })
+ = do (env, bndrs') <- simplBinders env bndrs
+ args' <- mapM (simplExprGently env) args
+ rhs' <- simplExprGently env rhs
+ return (rule { ru_bndrs = bndrs', ru_args = args', ru_rhs = rhs' })
-- It's important that simplExprGently does eta reduction.
-- For example, in a rule like:
-- It's important that simplExprGently does eta reduction.
-- For example, in a rule like:
@@
-333,8
+333,8
@@
simplExprGently :: SimplEnv -> CoreExpr -> SimplM CoreExpr
-- and in fact that is so.... but the 'Gently' in simplExprGently doesn't
-- enforce that; it just simplifies the expression twice
-- and in fact that is so.... but the 'Gently' in simplExprGently doesn't
-- enforce that; it just simplifies the expression twice
-simplExprGently env expr
- = simplExpr env (occurAnalyseExpr expr) `thenSmpl` \ expr1 ->
+simplExprGently env expr = do
+ expr1 <- simplExpr env (occurAnalyseExpr expr)
simplExpr env (occurAnalyseExpr expr1)
\end{code}
simplExpr env (occurAnalyseExpr expr1)
\end{code}