mkPDataType,
mkBuiltinCo,
mkVScrut,
-
+
+ preprSynTyCon,
pdataReprTyCon,
pdataReprDataCon,
+ prDFunOfTyCon
)
where
import Vectorise.Monad
import Outputable
import FastString
+import Control.Monad (liftM)
+
-- Simple Types ---------------------------------------------------------------
voidType :: VM Type
where
ty = exprType ve
+preprSynTyCon :: Type -> VM (TyCon, [Type])
+preprSynTyCon ty = builtin preprTyCon >>= (`lookupFamInst` [ty])
+
pdataReprTyCon :: Type -> VM (TyCon, [Type])
pdataReprTyCon ty = builtin pdataTyCon >>= (`lookupFamInst` [ty])
let [dc] = tyConDataCons tc
return (dc, arg_tys)
+prDFunOfTyCon :: TyCon -> VM CoreExpr
+prDFunOfTyCon tycon
+ = liftM Var
+ . maybeCantVectoriseM "No PR dictionary for tycon" (ppr tycon)
+ $ lookupTyConPR tycon