+ | Just tycon <- splitPrimTyCon ty
+ = do
+ arr <- traceMaybeV "mkPArrayType" (ppr tycon)
+ $ lookupPrimPArray tycon
+ return $ mkTyConApp arr []
+mkPArrayType ty = mkBuiltinTyConApp parrayTyCon [ty]
+
+mkBuiltinCo :: (Builtins -> TyCon) -> VM Coercion
+mkBuiltinCo get_tc
+ = do
+ tc <- builtin get_tc
+ return $ mkTyConApp tc []
+
+parrayReprTyCon :: Type -> VM (TyCon, [Type])
+parrayReprTyCon ty = builtin parrayTyCon >>= (`lookupFamInst` [ty])
+
+parrayReprDataCon :: Type -> VM (DataCon, [Type])
+parrayReprDataCon ty
+ = do
+ (tc, arg_tys) <- parrayReprTyCon ty
+ let [dc] = tyConDataCons tc
+ return (dc, arg_tys)
+
+mkVScrut :: VExpr -> VM (VExpr, TyCon, [Type])
+mkVScrut (ve, le)