X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcoreSyn%2FCoreUtils.lhs;h=25224a6e4df176ed0cc355a90caee39beabedac3;hb=9ffadf219cbc4f8ec57264786df936a3cee88aec;hp=07709c8a42c6d624a1bbcac65c5a538e1f0d4ef5;hpb=55a95e74e844fee27a9990beb9350b033a4e1344;p=ghc-hetmet.git diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs index 07709c8..25224a6 100644 --- a/compiler/coreSyn/CoreUtils.lhs +++ b/compiler/coreSyn/CoreUtils.lhs @@ -18,7 +18,7 @@ module CoreUtils ( -- * Constructing expressions mkInlineMe, mkSCC, mkCoerce, mkCoerceI, bindNonRec, needsCaseBinding, - mkIfThenElse, mkAltExpr, mkPiType, mkPiTypes, + mkAltExpr, mkPiType, mkPiTypes, -- * Taking expressions apart findDefault, findAlt, isDefaultAlt, mergeAlts, trimConArgs, @@ -71,7 +71,6 @@ import NewDemand import Type import Coercion import TyCon -import TysWiredIn import CostCentre import BasicTypes import Unique @@ -155,7 +154,8 @@ applyTypeToArgs e op_ty (Type ty : args) go rev_tys rest_args = applyTypeToArgs e op_ty' rest_args where op_ty' = applyTysD msg op_ty (reverse rev_tys) - msg = panic_msg e op_ty + msg = ptext (sLit "applyTypeToArgs") <+> + panic_msg e op_ty applyTypeToArgs e op_ty (_ : args) = case (splitFunTy_maybe op_ty) of @@ -298,13 +298,6 @@ mkAltExpr (LitAlt lit) [] [] = Lit lit mkAltExpr (LitAlt _) _ _ = panic "mkAltExpr LitAlt" mkAltExpr DEFAULT _ _ = panic "mkAltExpr DEFAULT" - -mkIfThenElse :: CoreExpr -> CoreExpr -> CoreExpr -> CoreExpr -mkIfThenElse guard then_expr else_expr --- Not going to be refining, so okay to take the type of the "then" clause - = Case guard (mkWildId boolTy) (exprType then_expr) - [ (DataAlt falseDataCon, [], else_expr), -- Increasing order of tag! - (DataAlt trueDataCon, [], then_expr) ] \end{code} @@ -505,10 +498,10 @@ exprIsCheap other_expr -- Applications and variables go (Var _) [] = True -- Just a type application of a variable -- (f t1 t2 t3) counts as WHNF go (Var f) args - = case globalIdDetails f of - RecordSelId {} -> go_sel args - ClassOpId _ -> go_sel args - PrimOpId op -> go_primop op args + = case idDetails f of + RecSelId {} -> go_sel args + ClassOpId _ -> go_sel args + PrimOpId op -> go_primop op args DataConWorkId _ -> go_pap args _ | length args < idArity f -> go_pap args @@ -585,7 +578,7 @@ exprOkForSpeculation (Note _ e) = exprOkForSpeculation e exprOkForSpeculation (Cast e _) = exprOkForSpeculation e exprOkForSpeculation other_expr = case collectArgs other_expr of - (Var f, args) -> spec_ok (globalIdDetails f) args + (Var f, args) -> spec_ok (idDetails f) args _ -> False where @@ -748,12 +741,12 @@ dataConInstPat :: (DataCon -> [Type]) -- function used to find arg tys -- ... -- -- has representation type --- forall a. forall a1. forall b. (a :=: (a1,b)) => +-- forall a. forall a1. forall b. (a ~ (a1,b)) => -- Int -> b -> T a -- -- dataConInstPat fss us T1 (a1',b') will return -- --- ([a1'', b''], [c :: (a1', b'):=:(a1'', b'')], [x :: Int, y :: b'']) +-- ([a1'', b''], [c :: (a1', b')~(a1'', b'')], [x :: Int, y :: b'']) -- -- where the double-primed variables are created with the FastStrings and -- Uniques given as fss and us @@ -809,7 +802,7 @@ exprIsConApp_maybe (Cast expr co) -- The transformation applies iff we have -- (C e1 ... en) `cast` co - -- where co :: (T t1 .. tn) :=: (T s1 ..sn) + -- where co :: (T t1 .. tn) ~ (T s1 ..sn) -- That is, with a T at the top of both sides -- The left-hand one must be a T, because exprIsConApp returned True -- but the right-hand one might not be. (Though it usually will.)