- returnNF_Tc (new_inst_infos, inst_mapper)
- where
- new_inst_infos = zipWithEqual "add_solns" mk_deriv_inst_info eqns solns
-
- all_inst_infos = inst_infos_in `unionBags` listToBag new_inst_infos
-
- mk_deriv_inst_info (clas, tycon, tyvars, _) theta
- = InstInfo clas tyvars [mkTyConApp tycon (mkTyVarTys tyvars)]
- theta
- dummy_dfun_id
- (my_panic "binds") (getSrcLoc tycon)
- (my_panic "upragmas")
- where
- dummy_dfun_id
- = mkVanillaId (getName tycon) dummy_dfun_ty
- -- The name is getSrcLoc'd in an error message
-
- dummy_dfun_ty = mkSigmaTy tyvars theta voidTy
- -- All we need from the dfun is its "theta" part, used during
- -- equation simplification (tcSimplifyThetas). The final
- -- dfun_id will have the superclass dictionaries as arguments too,
- -- but that'll be added after the equations are solved. For now,
- -- it's enough just to make a dummy dfun with the simple theta part.
- --
- -- The part after the theta is dummied here as voidTy; actually it's
- -- (C (T a b)), but it doesn't seem worth constructing it.
- -- We can't leave it as a panic because to get the theta part we
- -- have to run down the type!
-
- my_panic str = panic "add_soln" -- pprPanic ("add_soln:"++str) (hsep [char ':', ppr clas, ppr tycon])