Loosen the conditions for -XUndecidableInstances; fixes Trac #4200
authorsimonpj@microsoft.com <unknown>
Sun, 19 Sep 2010 16:26:23 +0000 (16:26 +0000)
committersimonpj@microsoft.com <unknown>
Sun, 19 Sep 2010 16:26:23 +0000 (16:26 +0000)
compiler/typecheck/TcMType.lhs

index a81270e..dd91b06 100644 (file)
@@ -1632,14 +1632,12 @@ sizeTypes xs               = sum (map sizeType xs)
 
 -- Size of a predicate
 --
 
 -- Size of a predicate
 --
--- Equalities are a special case.  The equality itself doesn't contribute to the
--- size and as we do not count class predicates, we have to start with one less.
--- This is easy to see considering that, given
---   class C a b | a -> b
---   type family F a
--- constraints (C a b) and (F a ~ b) are equivalent in size.
+-- We are considering whether *class* constraints terminate
+-- Once we get into an implicit parameter or equality we
+-- can't get back to a class constraint, so it's safe
+-- to say "size 0".  See Trac #4200.
 sizePred :: PredType -> Int
 sizePred (ClassP _ tys')   = sizeTypes tys'
 sizePred :: PredType -> Int
 sizePred (ClassP _ tys')   = sizeTypes tys'
-sizePred (IParam _ ty)     = sizeType ty
-sizePred (EqPred ty1 ty2)  = sizeType ty1 + sizeType ty2 - 1
+sizePred (IParam {})       = 0
+sizePred (EqPred {})       = 0
 \end{code}
 \end{code}