[commit: ghc] ghc-7.6: Test FlexibleInstance not UndecidableInstances in the ambiguity check (38d95c1)
Paolo Capriotti
p.capriotti at gmail.com
Wed Aug 15 19:24:58 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : ghc-7.6
http://hackage.haskell.org/trac/ghc/changeset/38d95c13fedc9966ee9731a69eef94d61cbba1d6
>---------------------------------------------------------------
commit 38d95c13fedc9966ee9731a69eef94d61cbba1d6
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Aug 15 16:02:03 2012 +0100
Test FlexibleInstance not UndecidableInstances in the ambiguity check
Fixes Trac #7131
MERGED from commit f7b096e8630c91a17ff9a551ab15060b21d84eb0
>---------------------------------------------------------------
compiler/typecheck/TcMType.lhs | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs
index b59d1cb..60bee0b 100644
--- a/compiler/typecheck/TcMType.lhs
+++ b/compiler/typecheck/TcMType.lhs
@@ -1305,9 +1305,9 @@ Is every call to 'g' ambiguous? After all, we might have
intance C [a] where ...
at the call site. So maybe that type is ok! Indeed even f's
quintessentially ambiguous type might, just possibly be callable:
-with -XUndecidableInstances we could have
+with -XFlexibleInstances we could have
instance C a where ...
-and now a call could be legal after all! (But only with -XUndecidableInstances!)
+and now a call could be legal after all! (But only with -XFlexibleInstances!)
What about things like this:
class D a b | a -> b where ..
@@ -1333,7 +1333,7 @@ where
* The constraints in 'Cambig' are all of form (C a b c)
where a,b,c are type variables
* 'Cambig' is non-empty
- * '-XUndecidableInstances' is not on.
+ * '-XFlexibleInstances' is not on.
And that is what checkAmbiguity does. See Trac #6134.
@@ -1375,8 +1375,8 @@ so we can take their type variables into account as part of the
checkAmbiguity :: [TyVar] -> ThetaType -> TyVarSet -> TcM ()
-- Note [The ambiguity check for type signatures]
checkAmbiguity forall_tyvars theta tau_tyvars
- = do { undecidable_instances <- xoptM Opt_UndecidableInstances
- ; unless undecidable_instances $
+ = do { flexible_instances <- xoptM Opt_FlexibleInstances
+ ; unless flexible_instances $
mapM_ ambigErr (filter is_ambig candidates) }
where
-- See Note [Implicit parameters and ambiguity] in TcSimplify
More information about the Cvs-ghc
mailing list