summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreSyn.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/coreSyn/CoreSyn.hs')
-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])