[project @ 1999-06-07 16:53:08 by simonmar]
authorsimonmar <unknown>
Mon, 7 Jun 1999 16:53:09 +0000 (16:53 +0000)
committersimonmar <unknown>
Mon, 7 Jun 1999 16:53:09 +0000 (16:53 +0000)
Existential constructors NEVER WORKED!  You were JUST IMAGINING IT!

ghc/compiler/basicTypes/DataCon.lhs
ghc/compiler/codeGen/CgConTbls.lhs

index d916dcb..2c5f7b4 100644 (file)
@@ -9,7 +9,8 @@ module DataCon (
        ConTag, fIRST_TAG,
        mkDataCon,
        dataConType, dataConSig, dataConName, dataConTag,
-       dataConOrigArgTys, dataConArgTys, dataConRawArgTys, dataConTyCon,
+       dataConOrigArgTys, dataConArgTys, dataConTyCon,
+       dataConRawArgTys, dataConAllRawArgTys,
        dataConFieldLabels, dataConStrictMarks, dataConSourceArity,
        dataConNumFields, dataConNumInstArgs, dataConId, dataConRepStrictness,
        isNullaryDataCon, isTupleCon, isUnboxedTupleCon,
@@ -338,9 +339,6 @@ dataConFieldLabels = dcFields
 dataConStrictMarks :: DataCon -> [StrictnessMark]
 dataConStrictMarks = dcRealStricts
 
-dataConRawArgTys :: DataCon -> [TauType] -- a function of convenience
-dataConRawArgTys = dcRepArgTys
-
 dataConSourceArity :: DataCon -> Arity
        -- Source-level arity of the data constructor
 dataConSourceArity dc = length (dcOrigArgTys dc)
@@ -383,6 +381,20 @@ dataConOrigArgTys (MkData {dcOrigArgTys = arg_tys, dcTyVars = tyvars,
        ([mkDictTy cls tys | (cls,tys) <- ex_theta] ++ arg_tys)
 \end{code}
 
+These two functions get the real argument types of the constructor,
+without substituting for any type variables.  dataConAllRawArgTys is
+like dataConRawArgTys except that the existential dictionary arguments
+are included.
+
+\begin{code}
+dataConRawArgTys :: DataCon -> [TauType] -- a function of convenience
+dataConRawArgTys = dcRepArgTys
+
+dataConAllRawArgTys :: DataCon -> [TauType]
+dataConAllRawArgTys con = 
+  [mkDictTy cls tys | (cls,tys) <- dcExTheta con] ++ dcRepArgTys con
+\end{code}
+
 dataConNumFields gives the number of actual fields in the
 {\em representation} of the data constructor.  This may be more than appear
 in the source code; the extra ones are the existentially quantified
index 6b75ee5..7ae92a8 100644 (file)
@@ -20,7 +20,7 @@ import ClosureInfo    ( layOutStaticClosure, layOutDynCon,
                        )
 import CostCentre      ( dontCareCCS )
 import FiniteMap       ( fmToList, FiniteMap )
-import DataCon         ( DataCon, dataConName, dataConRawArgTys )
+import DataCon         ( DataCon, dataConName, dataConAllRawArgTys )
 import Const           ( Con(..) )
 import Name            ( getOccString )
 import PrimRep         ( getPrimRepSize, PrimRep(..) )
@@ -161,7 +161,7 @@ genConInfo comp_info tycon data_con
 
     zero_arity_con   = all zero_size arg_tys
 
-    arg_tys        = dataConRawArgTys     data_con
+    arg_tys        = dataConAllRawArgTys  data_con
     entry_label     = mkConEntryLabel      con_name
     closure_label   = mkStaticClosureLabel con_name
     con_name       = dataConName data_con
@@ -173,7 +173,7 @@ mkConCodeAndInfo :: DataCon         -- Data constructor
 
 mkConCodeAndInfo con
   = let
-       arg_tys = dataConRawArgTys con
+       arg_tys = dataConAllRawArgTys con
 
        (closure_info, arg_things)
                = layOutDynCon con typePrimRep arg_tys