- ppr_dfun dfun = ppr (getSrcLoc dfun) <> colon <+> pprClassPred clas tys
- where
- (_,_,clas,tys) = tcSplitDFunTy (idType dfun)
+
+ ppr_dfun dfun = pp_loc <> colon <+> pprClassPred clas tys
+ where
+ (_,_,clas,tys) = tcSplitDFunTy (idType dfun)
+ loc = getSrcLoc dfun
+ mod = nameModule (idName dfun)
+
+ -- Worth trying to print a good location... imported dfuns
+ -- don't have a useful SrcLoc but we can say which module they come from
+ pp_loc | isGoodSrcLoc loc = ppr loc
+ | otherwise = ptext SLIT("In module") <+> ppr mod