2 Vect, VVar, VExpr, VBind,
11 vVar, vType, vNote, vLet,
12 vLams, vLamsWithoutLC, vVarApps,
13 vCaseDEFAULT, vInlineMe
16 #include "HsVersions.h"
19 import CoreUtils ( mkInlineMe )
25 type VExpr = Vect CoreExpr
26 type VBind = Vect CoreBind
28 vectorised :: Vect a -> a
34 mapVect :: (a -> b) -> Vect a -> Vect b
35 mapVect f (x,y) = (f x, f y)
37 zipWithVect :: (a -> b -> c) -> Vect a -> Vect b -> Vect c
38 zipWithVect f (x1,y1) (x2,y2) = (f x1 x2, f y1 y2)
40 vVarType :: VVar -> Type
41 vVarType = varType . vectorised
46 vType :: Type -> VExpr
47 vType ty = (Type ty, Type ty)
49 vNote :: Note -> VExpr -> VExpr
50 vNote = mapVect . Note
52 vNonRec :: VVar -> VExpr -> VBind
53 vNonRec = zipWithVect NonRec
55 vRec :: [VVar] -> [VExpr] -> VBind
56 vRec vs es = (Rec (zip vvs ves), Rec (zip lvs les))
61 vLet :: VBind -> VExpr -> VExpr
62 vLet = zipWithVect Let
64 vLams :: Var -> [VVar] -> VExpr -> VExpr
65 vLams lc vs (ve, le) = (mkLams vvs ve, mkLams (lc:lvs) le)
69 vLamsWithoutLC :: [VVar] -> VExpr -> VExpr
70 vLamsWithoutLC vvs (ve,le) = (mkLams vs ve, mkLams ls le)
74 vVarApps :: Var -> VExpr -> [VVar] -> VExpr
75 vVarApps lc (ve, le) vvs = (ve `mkVarApps` vs, le `mkVarApps` (lc : ls))
79 vCaseDEFAULT :: VExpr -> VVar -> Type -> Type -> VExpr -> VExpr
80 vCaseDEFAULT (vscrut, lscrut) (vbndr, lbndr) vty lty (vbody, lbody)
81 = (Case vscrut vbndr vty (mkDEFAULT vbody),
82 Case lscrut lbndr lty (mkDEFAULT lbody))
84 mkDEFAULT e = [(DEFAULT, [], e)]
86 vInlineMe :: VExpr -> VExpr
87 vInlineMe (vexpr, lexpr) = (mkInlineMe vexpr, mkInlineMe lexpr)