From 51bfcc0e6baad4032a6892a3e7d44a9e52b0961e Mon Sep 17 00:00:00 2001
From: Simon Peyton Jones <simonpj@microsoft.com>
Date: Tue, 17 Jan 2012 08:35:38 +0000
Subject: [PATCH] Allow default superclass methods for multi-parameter type
 classes

They were prohibited by mistake, a historical hangover
---
 compiler/typecheck/TcTyClsDecls.lhs | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs
index f91ccdf43d6d..ba1b011e82f5 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)) $
-- 
GitLab