summaryrefslogtreecommitdiff
path: root/compiler/coreSyn
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-07-06 15:44:18 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2016-07-11 11:14:39 +0200
commitcc95b211e7d08cda47d3e86632b5f514d5c8a876 (patch)
tree7f1523520664b5d1d6ac28f5b46aa4cbace472d8 /compiler/coreSyn
parent0ab63cf48580abbfe15ece934aec093203f29ed2 (diff)
downloadhaskell-wip/T12370.tar.gz
Demand analyser: Implement LetUp rule (#12370)wip/T12370
This makes the implementation match the description in the paper more closely: There, a let binding that is not a function has first its body analised, and then the binding’s RHS. This way, the demand on the bound variable by the body can be fed into the RHS, yielding more precise results. Performance measurements do unfortunately not show significant improvements or regessions. Differential Revision: https://phabricator.haskell.org/D2395
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r--compiler/coreSyn/CoreSyn.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs
index a6f8f82ec8..9ddad9cea1 100644
--- a/compiler/coreSyn/CoreSyn.hs
+++ b/compiler/coreSyn/CoreSyn.hs
@@ -32,6 +32,7 @@ module CoreSyn (
-- ** Simple 'Expr' access functions and predicates
bindersOf, bindersOfBinds, rhssOfBind, rhssOfAlts,
collectBinders, collectTyBinders, collectTyAndValBinders,
+ isLam,
collectArgs, collectArgsTicks, flattenBinds,
exprToType, exprToCoercion_maybe,
@@ -1656,6 +1657,13 @@ collectTyAndValBinders expr
(tvs, body1) = collectTyBinders expr
(ids, body) = collectValBinders body1
+-- | Is this a lambda (not hidden inside a cast or so)?
+-- This relates to 'collectBinders':
+-- > isLam e /= null (fst (collectBinders e))
+isLam :: CoreExpr -> Bool
+isLam (Lam _ _) = True
+isLam _ = False
+
-- | Takes a nested application expression and returns the the function
-- being applied and the arguments to which it is applied
collectArgs :: Expr b -> (Expr b, [Arg b])