import Type ( TyThing(..) )
import Class ( Class, classSelIds, classTyCon )
-import TyCon ( TyCon, tyConSelIds, tyConDataCons )
+import TyCon ( TyCon, tyConSelIds, tyConDataCons, isNewTyCon, newTyConCo )
import DataCon ( dataConImplicitIds )
import PrelNames ( gHC_PRIM )
import Packages ( PackageId )
| ModuleHidden PackageId
-- for an explicit source import: the package containing the module is
-- exposed, but the module itself is hidden.
- | NotFound [FilePath]
- -- the module was not found, the specified places were searched.
+ | NotFound [FilePath] (Maybe PackageId)
+ -- the module was not found, the specified places were searched
| NotFoundInPackage PackageId
-- the module was not found in this package
\begin{code}
implicitTyThings :: TyThing -> [TyThing]
+-- If you change this, make sure you change LoadIface.ifaceDeclSubBndrs in sync
+
implicitTyThings (AnId id) = []
-- For type constructors, add the data cons (and their extras),
-- and the selectors and generic-programming Ids too
--
-- Newtypes don't have a worker Id, so don't generate that?
-implicitTyThings (ATyCon tc) = map AnId (tyConSelIds tc) ++
+implicitTyThings (ATyCon tc) = implicitNewCoTyCon tc ++
+ map AnId (tyConSelIds tc) ++
concatMap (extras_plus . ADataCon) (tyConDataCons tc)
-- For classes, add the class TyCon too (and its extras)
-- For data cons add the worker and wrapper (if any)
implicitTyThings (ADataCon dc) = map AnId (dataConImplicitIds dc)
+ -- For newtypes, add the implicit coercion tycon
+implicitNewCoTyCon tc | isNewTyCon tc = [ATyCon (newTyConCo tc)]
+ | otherwise = []
+
extras_plus thing = thing : implicitTyThings thing
extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnv
_other -> text (msObjFilePath mod_summary),
char ')'])
where
- mod = ms_mod mod_summary
+ mod = moduleName (ms_mod mod_summary)
mod_str = showSDoc (ppr mod) ++ hscSourceString (ms_hsc_src mod_summary)
\end{code}