From: Roman Leshchinskiy Date: Wed, 18 Jul 2007 02:52:35 +0000 (+0000) Subject: Generation of DataCons for implicit PArray instances X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=b7d4252cd20ed2fcb9f62a7f75bb65de9971b4c7 Generation of DataCons for implicit PArray instances --- diff --git a/compiler/vectorise/VectType.hs b/compiler/vectorise/VectType.hs index 45b22ad..ebf1797 100644 --- a/compiler/vectorise/VectType.hs +++ b/compiler/vectorise/VectType.hs @@ -15,6 +15,7 @@ import OccName import MkId import BasicTypes ( StrictnessMark(..), boolToRecFlag ) import NameEnv +import TysWiredIn import Unique import UniqFM @@ -161,6 +162,40 @@ vectDataCon dc rep_arg_tys = dataConRepArgTys dc tycon = dataConTyCon dc +{- +mkPArrTyCon :: TyCon -> VM TyCon +mkPArrTyCon tc = fixV $ \repr_tc -> + do +-} + +mkPArrayDataCon :: TyCon -> TyCon -> VM DataCon +mkPArrayDataCon orig_tc repr_tc + = do + name <- cloneName mkPArrayDataConOcc (tyConName orig_tc) + shape_ty <- mkPArrayType intTy -- FIXME: we want to unbox this! + repr_tys <- mapM mkPArrayType types + wrk_name <- cloneName mkDataConWorkerOcc name + wrp_name <- cloneName mkDataConWrapperOcc name + + let ids = mkDataConIds wrp_name wrk_name data_con + data_con = mkDataCon name + False + (MarkedStrict : map (const NotMarkedStrict) repr_tys) + [] + (tyConTyVars orig_tc) + [] + [] + [] + repr_tys + repr_tc + [] + ids + + return data_con + where + types = [ty | dc <- tyConDataCons orig_tc + , ty <- dataConRepArgTys dc] + -- | Split the given tycons into two sets depending on whether they have to be -- converted (first list) or not (second list). The first argument contains -- information about the conversion status of external tycons: