Monadify specialise/Specialise: use do, return, standard monad functions and MonadUnique
[ghc-hetmet.git] / compiler / vectorise / VectUtils.hs
index a540b4d..533a8e7 100644 (file)
@@ -259,7 +259,7 @@ emptyPA :: Type -> VM CoreExpr
 emptyPA = paMethod pa_empty
 
 packPA :: Type -> CoreExpr -> CoreExpr -> CoreExpr -> VM CoreExpr
-packPA ty xs len sel = liftM (`mkApps` [len, sel])
+packPA ty xs len sel = liftM (`mkApps` [xs, len, sel])
                              (paMethod pa_pack ty)
 
 combinePA :: Type -> CoreExpr -> CoreExpr -> CoreExpr -> [CoreExpr]
@@ -451,11 +451,16 @@ mkLiftEnv lc [ty] [v]
 mkLiftEnv lc tys vs
   = do
       (env_tc, env_tyargs) <- parrayReprTyCon vty
+
+      bndrs <- if null vs then do
+                                 v <- newDummyVar unitTy
+                                 return [v]
+                          else return vs
       let [env_con] = tyConDataCons env_tc
           
           env = Var (dataConWrapId env_con)
                 `mkTyApps`  env_tyargs
-                `mkVarApps` (lc : vs)
+                `mkApps`    (Var lc : args)
 
           bind env body = let scrut = unwrapFamInstScrut env_tc env_tyargs env
                           in
@@ -466,6 +471,6 @@ mkLiftEnv lc tys vs
   where
     vty = mkCoreTupTy tys
 
-    bndrs | null vs   = [mkWildId unitTy]
-          | otherwise = vs
+    args  | null vs   = [Var unitDataConId]
+          | otherwise = map Var vs