Commit cb9e4b09 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-07-26 08:31:21 by simonpj]

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)
parent fb8cc4c6
...@@ -40,7 +40,7 @@ import Type ( tidyTopType ) ...@@ -40,7 +40,7 @@ import Type ( tidyTopType )
import TcType ( isFFITy ) import TcType ( isFFITy )
import DataCon ( dataConName, dataConFieldLabels, dataConWrapId_maybe ) import DataCon ( dataConName, dataConFieldLabels, dataConWrapId_maybe )
import TyCon ( TyCon, makeTyConAbstract, tyConDataCons, isNewTyCon, import TyCon ( TyCon, makeTyConAbstract, tyConDataCons, isNewTyCon,
newTyConRep, tyConSelIds, isAlgTyCon ) newTyConRep, tyConSelIds, isAlgTyCon, isEnumerationTyCon )
import Class ( classSelIds ) import Class ( classSelIds )
import Module ( Module ) import Module ( Module )
import HscTypes ( HscEnv(..), NameCache( nsUniqs ), CgGuts(..), import HscTypes ( HscEnv(..), NameCache( nsUniqs ), CgGuts(..),
...@@ -349,6 +349,9 @@ mustExposeTyCon :: NameSet -- Exports ...@@ -349,6 +349,9 @@ mustExposeTyCon :: NameSet -- Exports
mustExposeTyCon exports tc mustExposeTyCon exports tc
| not (isAlgTyCon tc) -- Synonyms | not (isAlgTyCon tc) -- Synonyms
= True = 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 | otherwise -- Newtype, datatype
= any exported_con (tyConDataCons tc) = any exported_con (tyConDataCons tc)
-- Expose rep if any datacon or field is exported -- Expose rep if any datacon or field is exported
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment