X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcoreSyn%2FCoreSyn.lhs;h=79e25a2be0d0201ae821f60dd2c545d7f99837cd;hb=35fb5c6ff0861be5ab72df799df536982d3966b8;hp=e259591c14c8d7c31d31d27bc725cd6cf4ba0e9c;hpb=c168c43449a92bd1c4588d41807d963d491b8588;p=ghc-hetmet.git diff --git a/compiler/coreSyn/CoreSyn.lhs b/compiler/coreSyn/CoreSyn.lhs index e259591..79e25a2 100644 --- a/compiler/coreSyn/CoreSyn.lhs +++ b/compiler/coreSyn/CoreSyn.lhs @@ -25,7 +25,7 @@ module CoreSyn ( mkConApp, mkTyBind, varToCoreExpr, varsToCoreExprs, - isTyVar, isId, cmpAltCon, cmpAlt, ltAlt, + isTyVar, isIdVar, cmpAltCon, cmpAlt, ltAlt, -- ** Simple 'Expr' access functions and predicates bindersOf, bindersOfBinds, rhssOfBind, rhssOfAlts, @@ -68,7 +68,6 @@ module CoreSyn ( import CostCentre import Var -import Id import Type import Coercion import Name @@ -199,7 +198,6 @@ data Expr b -- -- @ -- data Foo = Red | Green | Blue - -- -- ... case x of -- Red -> True -- other -> f (case x of @@ -706,7 +704,7 @@ mkTyBind tv ty = NonRec tv (Type ty) -- | Convert a binder into either a 'Var' or 'Type' 'Expr' appropriately varToCoreExpr :: CoreBndr -> Expr b -varToCoreExpr v | isId v = Var v +varToCoreExpr v | isIdVar v = Var v | otherwise = Type (mkTyVarTy v) varsToCoreExprs :: [CoreBndr] -> [Expr b] @@ -738,7 +736,7 @@ rhssOfAlts :: [Alt b] -> [Expr b] rhssOfAlts alts = [e | (_,_,e) <- alts] -- | Collapse all the bindings in the supplied groups into a single --- list of lhs/rhs pairs suitable for binding in a 'Rec' binding group +-- list of lhs\/rhs pairs suitable for binding in a 'Rec' binding group flattenBinds :: [Bind b] -> [(b, Expr b)] flattenBinds (NonRec b r : binds) = (b,r) : flattenBinds binds flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds @@ -779,8 +777,8 @@ collectTyBinders expr collectValBinders expr = go [] expr where - go ids (Lam b e) | isId b = go (b:ids) e - go ids body = (reverse ids, body) + go ids (Lam b e) | isIdVar b = go (b:ids) e + go ids body = (reverse ids, body) \end{code} \begin{code} @@ -818,7 +816,7 @@ at runtime. Similarly isRuntimeArg. \begin{code} -- | Will this variable exist at runtime? isRuntimeVar :: Var -> Bool -isRuntimeVar = isId +isRuntimeVar = isIdVar -- | Will this argument expression exist at runtime? isRuntimeArg :: CoreExpr -> Bool @@ -836,7 +834,7 @@ isTypeArg _ = False -- | The number of binders that bind values rather than types valBndrCount :: [CoreBndr] -> Int -valBndrCount = count isId +valBndrCount = count isIdVar -- | The number of argument expressions that are values rather than types at their top level valArgCount :: [Arg b] -> Int