From: Matthijs Kooijman Date: Fri, 26 Jun 2009 09:59:59 +0000 (+0200) Subject: Add has_free_vars predicate. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=77299c48da1e8a3cbbd3d9d23ead7f03754ca3bf;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add has_free_vars predicate. --- diff --git a/CoreTools.hs b/CoreTools.hs index c797bb7..dfb4f5c 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -149,6 +149,10 @@ is_applicable expr = is_fun expr || is_poly expr has_free_tyvars :: CoreSyn.CoreExpr -> Bool has_free_tyvars = not . VarSet.isEmptyVarSet . (CoreFVs.exprSomeFreeVars Var.isTyVar) +-- Does the given CoreExpr have any free local vars? +has_free_vars :: CoreSyn.CoreExpr -> Bool +has_free_vars = not . VarSet.isEmptyVarSet . CoreFVs.exprFreeVars + -- Turns a Var CoreExpr into the Id inside it. Will of course only work for -- simple Var CoreExprs, not complexer ones. exprToVar :: CoreSyn.CoreExpr -> Var.Id