, tyvars' <- map (mkTyVarTy . mk_skol_tv) tyvars
= substTyWith tyvars tyvars' ty
mk_skol_tv tv = mkTcTyVar (tyVarName tv) (tyVarKind tv)
- (SkolemTv UnkSkol)
+ (SkolemTv RuntimeUnkSkol)
skolemiseTyVar :: TyVar -> TyVar
skolemiseTyVar tyvar = mkTcTyVar (tyVarName tyvar) (tyVarKind tyvar)
- (SkolemTv UnkSkol)
+ (SkolemTv RuntimeUnkSkol)
-----------------------------------------------------------------------------
-- show a module and it's source/object filenames
= findGlobals (mkVarSet inst_tvs) tidy_env `thenM` \ (tidy_env, docs) ->
returnM (tidy_env, mk_msg docs)
where
+ mk_msg _ | any isRuntimeUnk inst_tvs
+ = vcat [ptext SLIT("Cannot resolve unkonwn runtime types:") <+>
+ (pprWithCommas ppr inst_tvs),
+ ptext SLIT("Use :print or :force to determine these types")]
mk_msg [] = ptext SLIT("Probable fix: add a type signature that fixes these type variable(s)")
-- This happens in things like
-- f x = show (read "foo")
nest 2 (vcat docs),
monomorphism_fix
]
+
+isRuntimeUnk :: TcTyVar -> Bool
+isRuntimeUnk x | SkolemTv RuntimeUnkSkol <- tcTyVarDetails x = True
+ | otherwise = False
+
monomorphism_fix :: SDoc
monomorphism_fix = ptext SLIT("Probable fix:") <+>
(ptext SLIT("give these definition(s) an explicit type signature")
| GenSkol [TcTyVar] -- Bound when doing a subsumption check for
TcType -- (forall tvs. ty)
+ | RuntimeUnkSkol -- a type variable used to represent an unknown
+ -- runtime type (used in the GHCi debugger)
+
| UnkSkol -- Unhelpful info (until I improve it)
-------------------------------------
ppr_details (SkolemTv info) = ppr_skol info
ppr_skol UnkSkol = empty -- Unhelpful; omit
+ ppr_skol RuntimeUnkSkol = quotes (ppr tv) <+> ptext SLIT("is an unknown runtime type")
ppr_skol info = quotes (ppr tv) <+> ptext SLIT("is bound by")
<+> sep [pprSkolInfo info, nest 2 (ptext SLIT("at") <+> ppr (getSrcLoc tv))]
-- For type variables the others are dealt with by pprSkolTvBinding.
-- For Insts, these cases should not happen
pprSkolInfo UnkSkol = panic "UnkSkol"
+pprSkolInfo RuntimeUnkSkol = panic "RuntimeUnkSkol"
instance Outputable MetaDetails where
ppr Flexi = ptext SLIT("Flexi")