[project @ 2005-07-26 08:31:21 by simonpj]
authorsimonpj <unknown>
Tue, 26 Jul 2005 08:31:21 +0000 (08:31 +0000)
committersimonpj <unknown>
Tue, 26 Jul 2005 08:31:21 +0000 (08:31 +0000)
When trimming type constructors for export, no need to trim enumerations,
because they don't give rise to any further exported things.

(Minor improvement: no need to merge)

ghc/compiler/main/TidyPgm.lhs

index 62a2c82..ef3864b 100644 (file)
@@ -40,7 +40,7 @@ import Type           ( tidyTopType )
 import TcType          ( isFFITy )
 import DataCon         ( dataConName, dataConFieldLabels, dataConWrapId_maybe )
 import TyCon           ( TyCon, makeTyConAbstract, tyConDataCons, isNewTyCon, 
-                         newTyConRep, tyConSelIds, isAlgTyCon )
+                         newTyConRep, tyConSelIds, isAlgTyCon, isEnumerationTyCon )
 import Class           ( classSelIds )
 import Module          ( Module )
 import HscTypes                ( HscEnv(..), NameCache( nsUniqs ), CgGuts(..),
@@ -349,6 +349,9 @@ mustExposeTyCon :: NameSet  -- Exports
 mustExposeTyCon exports tc
   | not (isAlgTyCon tc)        -- Synonyms
   = True
+  | isEnumerationTyCon tc      -- For an enumeration, exposing the constructors
+  = True                       -- won't lead to the need for further exposure
+                               -- (This includes data types with no constructors.)
   | otherwise                  -- Newtype, datatype
   = any exported_con (tyConDataCons tc)
        -- Expose rep if any datacon or field is exported