ifaceConDecls _ | abstract = IfAbstractTyCon
ifaceConDecls (NewTyCon con _ _) = IfNewTyCon (ifaceConDecl con)
ifaceConDecls (DataTyCon cons _) = IfDataTyCon (map ifaceConDecl cons)
- ifaceConDecls AbstractTyCon = pprPanic "ifaceConDecls" (ppr tycon)
- -- We're exporting this thing, so it's locally defined and should not be abstract
+ ifaceConDecls AbstractTyCon = IfAbstractTyCon
+ -- The last case should never happen when we are generating an
+ -- interface file (we're exporting this thing, so it's locally defined
+ -- and should not be abstract). But tyThingToIfaceDecl is also used
+ -- in TcRnDriver for GHCi, when browsing a module, in which case the
+ -- AbstractTyCon case is perfectly sensible.
ifaceConDecl data_con
= IfaceConDecl (getOccName (dataConName data_con))
--------------------------
-dfunToIfaceInst :: ModuleName -> DFunId -> IfaceInst
-dfunToIfaceInst mod dfun_id
- = IfaceInst { ifDFun = getOccName dfun_id,
+dfunToIfaceInst :: DFunId -> IfaceInst
+dfunToIfaceInst dfun_id
+ = IfaceInst { ifDFun = nameOccName dfun_name,
ifInstHead = toIfaceType (mkLhsNameFn mod) tidy_ty }
where
+ dfun_name = idName dfun_id
+ mod = nameModuleName dfun_name
(tvs, _, cls, tys) = tcSplitDFunTy (idType dfun_id)
head_ty = mkForAllTys tvs (mkPredTy (mkClassPred cls tys))
-- No need to record the instance context;