+tidyBootTypeEnv :: NameSet -> TypeEnv -> TypeEnv
+tidyBootTypeEnv exports type_env
+ = tidyTypeEnv True exports type_env final_ids
+ where
+ -- Find the LocalIds in the type env that are exported
+ -- Make them into GlobalIds, and tidy their types
+ --
+ -- It's very important to remove the non-exported ones
+ -- because we don't tidy the OccNames, and if we don't remove
+ -- the non-exported ones we'll get many things with the
+ -- same name in the interface file, giving chaos.
+ final_ids = [ tidyExternalId id
+ | id <- typeEnvIds type_env
+ , isLocalId id
+ , keep_it id ]
+
+ -- default methods have their export flag set, but everything
+ -- else doesn't (yet), because this is pre-desugaring, so we
+ -- must test both.
+ keep_it id = isExportedId id || idName id `elemNameSet` exports