2 Vect, VVar, VExpr, VBind,
11 vVar, vType, vNote, vLet,
12 vLams, vLamsWithoutLC, vVarApps,
16 #include "HsVersions.h"
24 type VExpr = Vect CoreExpr
25 type VBind = Vect CoreBind
27 vectorised :: Vect a -> a
33 mapVect :: (a -> b) -> Vect a -> Vect b
34 mapVect f (x,y) = (f x, f y)
36 zipWithVect :: (a -> b -> c) -> Vect a -> Vect b -> Vect c
37 zipWithVect f (x1,y1) (x2,y2) = (f x1 x2, f y1 y2)
39 vVarType :: VVar -> Type
40 vVarType = varType . vectorised
45 vType :: Type -> VExpr
46 vType ty = (Type ty, Type ty)
48 vNote :: Note -> VExpr -> VExpr
49 vNote = mapVect . Note
51 vNonRec :: VVar -> VExpr -> VBind
52 vNonRec = zipWithVect NonRec
54 vRec :: [VVar] -> [VExpr] -> VBind
55 vRec vs es = (Rec (zip vvs ves), Rec (zip lvs les))
60 vLet :: VBind -> VExpr -> VExpr
61 vLet = zipWithVect Let
63 vLams :: Var -> [VVar] -> VExpr -> VExpr
64 vLams lc vs (ve, le) = (mkLams vvs ve, mkLams (lc:lvs) le)
68 vLamsWithoutLC :: [VVar] -> VExpr -> VExpr
69 vLamsWithoutLC vvs (ve,le) = (mkLams vs ve, mkLams ls le)
73 vVarApps :: Var -> VExpr -> [VVar] -> VExpr
74 vVarApps lc (ve, le) vvs = (ve `mkVarApps` vs, le `mkVarApps` (lc : ls))
78 vCaseDEFAULT :: VExpr -> VVar -> Type -> Type -> VExpr -> VExpr
79 vCaseDEFAULT (vscrut, lscrut) (vbndr, lbndr) vty lty (vbody, lbody)
80 = (Case vscrut vbndr vty (mkDEFAULT vbody),
81 Case lscrut lbndr lty (mkDEFAULT lbody))
83 mkDEFAULT e = [(DEFAULT, [], e)]