Make a panic into an ASSERT
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 25 Oct 2016 14:21:31 +0000 (15:21 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 25 Nov 2016 08:33:31 +0000 (08:33 +0000)
compiler/typecheck/FunDeps.hs

index 4da6795..0ca22bd 100644 (file)
@@ -195,11 +195,9 @@ improveFromInstEnv :: InstEnvs
                    -> [FunDepEqn loc] -- Needs to be a FunDepEqn because
                                       -- of quantified variables
 -- Post: Equations oriented from the template (matching instance) to the workitem!
-improveFromInstEnv _inst_env _ pred
-  | not (isClassPred pred)
-  = panic "improveFromInstEnv: not a class predicate"
 improveFromInstEnv inst_env mk_loc pred
-  | Just (cls, tys) <- getClassPredTys_maybe pred
+  | Just (cls, tys) <- ASSERT2( isClassPred pred, ppr pred )
+                       getClassPredTys_maybe pred
   , let (cls_tvs, cls_fds) = classTvsFds cls
         instances          = classInstances inst_env cls
         rough_tcs          = roughMatchTcs tys