Reject programs with superclass equalities for now
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>
Tue, 21 Oct 2008 13:17:21 +0000 (13:17 +0000)
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>
Tue, 21 Oct 2008 13:17:21 +0000 (13:17 +0000)
- The current implementation of type families cannot properly deal
  with superclass equalities.  Instead of making a half-hearted attempt at
  supporting them, which mostly ends in cryptic error message, rejecting
  right away with an appropriate message.

  MERGE TO 6.10

compiler/typecheck/TcMType.lhs

index 543c61c..6de3dd2 100644 (file)
@@ -1322,6 +1322,14 @@ check_pred_ty dflags ctxt pred@(ClassP cls tys)
     arity_err  = arityErr "Class" class_name arity n_tys
     how_to_allow = parens (ptext (sLit "Use -XFlexibleContexts to permit this"))
 
+check_pred_ty _ (ClassSCCtxt _) (EqPred _ _)
+  =   -- We do not yet support superclass equalities.
+    failWithTc $
+      sep [ ptext (sLit "The current implementation of type families does not")
+          , ptext (sLit "support equality constraints in superclass contexts.")
+          , ptext (sLit "They are planned for a future release.")
+          ]
+
 check_pred_ty dflags _ pred@(EqPred ty1 ty2)
   = do {       -- Equational constraints are valid in all contexts if type
                -- families are permitted