Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/51bfcc0e6baad4032a6892a3e7d44a9e52b0961e >--------------------------------------------------------------- commit 51bfcc0e6baad4032a6892a3e7d44a9e52b0961e Author: Simon Peyton Jones <[email protected]> Date: Tue Jan 17 08:35:38 2012 +0000 Allow default superclass methods for multi-parameter type classes They were prohibited by mistake, a historical hangover >--------------------------------------------------------------- compiler/typecheck/TcTyClsDecls.lhs | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs index f91ccdf..ba1b011 100644 --- a/compiler/typecheck/TcTyClsDecls.lhs +++ b/compiler/typecheck/TcTyClsDecls.lhs @@ -1365,17 +1365,10 @@ checkValidClass cls -- Check the associated type defaults are well-formed and instantiated -- See Note [Checking consistent instantiation] - ; mapM_ check_at_defs at_stuff - - -- Check that if the class has generic methods, then the - -- class has only one parameter. We can't do generic - -- multi-parameter type classes! - ; checkTc (unary || no_generics) (genericMultiParamErr cls) - } + ; mapM_ check_at_defs at_stuff } where (tyvars, fundeps, theta, _, at_stuff, op_stuff) = classExtraBigSig cls - unary = isSingleton (snd (splitKiTyVars tyvars)) -- IA0_NOTE: only count type arguments - no_generics = null [() | (_, (GenDefMeth _)) <- op_stuff] + unary = isSingleton (snd (splitKiTyVars tyvars)) -- IA0_NOTE: only count type arguments check_op constrained_class_methods (sel_id, dm) = addErrCtxt (classOpCtxt sel_id tau) $ do @@ -1700,11 +1693,6 @@ noClassTyVarErr clas op ptext (sLit "mentions none of the type variables of the class") <+> ppr clas <+> hsep (map ppr (classTyVars clas))] -genericMultiParamErr :: Class -> SDoc -genericMultiParamErr clas - = ptext (sLit "The multi-parameter class") <+> quotes (ppr clas) <+> - ptext (sLit "cannot have generic methods") - recSynErr :: [LTyClDecl Name] -> TcRn () recSynErr syn_decls = setSrcSpan (getLoc (head sorted_decls)) $ _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
