From a4980c2c58727d4337b48b7e4a7dcd4747d0fec7 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Mon, 9 Jul 2007 18:22:09 +0000 Subject: [PATCH] Tweak the undecidable-instance-checking logic Just looking at Opt_GlasgowExts is not sufficient to see if we need to do an instance undecidability check. Rather than try to enumerate all the extensions that may require us to do the check we now always do it. --- compiler/typecheck/TcMType.lhs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index e5ccbd0..9746e0c 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -1179,15 +1179,15 @@ instTypeErr pp_ty msg \begin{code} checkValidInstance :: [TyVar] -> ThetaType -> Class -> [TcType] -> TcM () checkValidInstance tyvars theta clas inst_tys - = do { gla_exts <- doptM Opt_GlasgowExts - ; undecidable_ok <- doptM Opt_AllowUndecidableInstances + = do { undecidable_ok <- doptM Opt_AllowUndecidableInstances ; checkValidTheta InstThetaCtxt theta ; checkAmbiguity tyvars theta (tyVarsOfTypes inst_tys) -- Check that instance inference will terminate (if we care) - -- For Haskell 98, checkValidTheta has already done that - ; when (gla_exts && not undecidable_ok) $ + -- For Haskell 98 this will already have been done by checkValidTheta, + -- but as we may be using other extensions we need to check. + ; unless undecidable_ok $ mapM_ addErrTc (checkInstTermination inst_tys theta) -- The Coverage Condition -- 1.7.10.4