Fix a bug in MatchCon, and clarify what dataConInstOrigArgTys does
[ghc-hetmet.git] / compiler / iface / BuildTyCl.lhs
index 707de1c..9f35453 100644 (file)
@@ -7,7 +7,7 @@
 module BuildTyCl (
        buildSynTyCon, buildAlgTyCon, buildDataCon,
        buildClass,
-       mkAbstractTyConRhs, mkOpenDataTyConRhs, mkOpenNewTyConRhs,
+       mkAbstractTyConRhs, mkOpenDataTyConRhs, 
        mkNewTyConRhs, mkDataTyConRhs 
     ) where
 
@@ -115,10 +115,7 @@ mkAbstractTyConRhs :: AlgTyConRhs
 mkAbstractTyConRhs = AbstractTyCon
 
 mkOpenDataTyConRhs :: AlgTyConRhs
-mkOpenDataTyConRhs = OpenTyCon Nothing False
-
-mkOpenNewTyConRhs :: AlgTyConRhs
-mkOpenNewTyConRhs = OpenTyCon Nothing True
+mkOpenDataTyConRhs = OpenTyCon Nothing
 
 mkDataTyConRhs :: [DataCon] -> AlgTyConRhs
 mkDataTyConRhs cons
@@ -151,6 +148,8 @@ mkNewTyConRhs tycon_name tycon con
     rhs_ty = head (dataConInstOrigArgTys con (mkTyVarTys tvs))
        -- Instantiate the data con with the 
        -- type variables from the tycon
+       -- NB: a newtype DataCon has no existentials; hence the
+       --     call to dataConInstOrigArgTys has the right type args
 
     etad_tvs :: [TyVar]        -- Matched lazily, so that mkNewTypeCoercion can
     etad_rhs :: Type   -- return a TyCon without pulling on rhs_ty