vNonRec, vRec,
vVar, vType, vNote, vLet,
- vLams, vLamsWithoutLC, vVarApps
+ vLams, vLamsWithoutLC, vVarApps,
+ vCaseDEFAULT, vCaseProd, vInlineMe
) where
#include "HsVersions.h"
import CoreSyn
+import CoreUtils ( mkInlineMe )
+import MkCore ( mkWildCase )
+import CoreUtils ( exprType )
+import DataCon ( DataCon )
import Type ( Type )
import Var
where
(vs,ls) = unzip vvs
+vCaseDEFAULT :: VExpr -> VVar -> Type -> Type -> VExpr -> VExpr
+vCaseDEFAULT (vscrut, lscrut) (vbndr, lbndr) vty lty (vbody, lbody)
+ = (Case vscrut vbndr vty (mkDEFAULT vbody),
+ Case lscrut lbndr lty (mkDEFAULT lbody))
+ where
+ mkDEFAULT e = [(DEFAULT, [], e)]
+
+vCaseProd :: VExpr -> Type -> Type
+ -> DataCon -> DataCon -> [Var] -> [VVar] -> VExpr -> VExpr
+vCaseProd (vscrut, lscrut) vty lty vdc ldc sh_bndrs bndrs
+ (vbody,lbody)
+ = (mkWildCase vscrut (exprType vscrut) vty
+ [(DataAlt vdc, vbndrs, vbody)],
+ mkWildCase lscrut (exprType lscrut) lty
+ [(DataAlt ldc, sh_bndrs ++ lbndrs, lbody)])
+ where
+ (vbndrs, lbndrs) = unzip bndrs
+
+vInlineMe :: VExpr -> VExpr
+vInlineMe (vexpr, lexpr) = (mkInlineMe vexpr, mkInlineMe lexpr)