import PrelInfo ( eRROR_ID )
import PprType ( pprConstraint, pprPred )
import TyCon ( TyCon, isSynTyCon, tyConDerivings )
-import Type ( mkTyVarTys, splitSigmaTy, isTyVarTy,
- splitTyConApp_maybe, splitDictTy_maybe,
+import Type ( mkTyVarTys, splitDFunTy, isTyVarTy,
+ splitTyConApp_maybe, splitDictTy,
splitAlgTyConApp_maybe, classesToPreds, classesOfPreds,
unUsgTy, tyVarsOfTypes, mkClassPred, mkTyVarTy,
getClassTys_maybe
-- Type-check all the stuff before the "where"
tcHsSigType poly_ty `thenTc` \ poly_ty' ->
let
- (tyvars, theta, dict_ty) = splitSigmaTy poly_ty'
- (clas, inst_tys) = case splitDictTy_maybe dict_ty of
- Just ct -> ct
- Nothing -> pprPanic "tcInstDecl1" (ppr poly_ty)
+ (tyvars, theta, clas, inst_tys) = splitDFunTy poly_ty'
in
(case maybe_dfun_name of
returnTc gen_inst_info
get_generics mod decl@(ClassDecl context class_name tyvar_names
- fundeps class_sigs def_methods pragmas
+ fundeps class_sigs def_methods
name_list loc)
| null groups
= returnTc [] -- The comon case:
-- Instantiate the instance decl with tc-style type variables
tcInstId dfun_id `thenNF_Tc` \ (inst_tyvars', dfun_theta', dict_ty') ->
let
- (clas, inst_tys') = expectJust "tcInstDecl2" (splitDictTy_maybe dict_ty')
+ (clas, inst_tys') = splitDictTy dict_ty'
origin = InstanceDeclOrigin
(class_tyvars, sc_theta, _, op_items) = classBigSig clas
where
(name, loc, thing)
= case decl of
- (ClassDecl _ name _ _ _ _ _ _ loc) -> (name, loc, "class")
- (TySynonym name _ _ loc) -> (name, loc, "type synonym")
- (TyData NewType _ name _ _ _ _ _ loc _ _) -> (name, loc, "newtype")
- (TyData DataType _ name _ _ _ _ _ loc _ _) -> (name, loc, "data type")
+ (ClassDecl _ name _ _ _ _ _ loc) -> (name, loc, "class")
+ (TySynonym name _ _ loc) -> (name, loc, "type synonym")
+ (TyData NewType _ name _ _ _ _ loc _ _) -> (name, loc, "newtype")
+ (TyData DataType _ name _ _ _ _ loc _ _) -> (name, loc, "data type")
ctxt = hsep [ptext SLIT("In the"), text thing,
ptext SLIT("declaration for"), quotes (ppr name)]