From: Matthijs Kooijman Date: Thu, 18 Jun 2009 08:58:54 +0000 (+0200) Subject: Add is_wild function to check for wild binders. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=1c0c371527493b595d8ee767c1ed5cedc0891a30;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add is_wild function to check for wild binders. --- diff --git a/CoreTools.hs b/CoreTools.hs index 3d3828b..63bca94 100644 --- a/CoreTools.hs +++ b/CoreTools.hs @@ -11,11 +11,15 @@ import qualified HsExpr import qualified HsTypes import qualified HsBinds import qualified RdrName +import qualified Name import qualified OccName import qualified TysWiredIn import qualified Bag import qualified DynFlags import qualified SrcLoc +import qualified CoreSyn +import qualified Var +import qualified Unique import GhcTools import HsTools @@ -77,3 +81,11 @@ fsvec_len ty = where (tycon, args) = Type.splitTyConApp ty [len, el_ty] = args + +-- Is this a wild binder? +is_wild :: CoreSyn.CoreBndr -> Bool +-- wild binders have a particular unique, that we copied from MkCore.lhs to +-- here. However, this comparison didn't work, so we'll just check the +-- occstring for now... TODO +--(Var.varUnique bndr) == (Unique.mkBuiltinUnique 1) +is_wild bndr = "wild" == (OccName.occNameString . Name.nameOccName . Var.varName) bndr