summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2006-09-18 00:51:42 +0000
committersimonpj@microsoft.com <unknown>2006-09-18 00:51:42 +0000
commitc5d2d92ce6295d7236c9e8a66a47e741d6f5388b (patch)
treede9c00dd54fd826000140b292dfa8c27d430d330 /compiler
parent40f5a0759bd07308009c3ae8956dfa061c684ebd (diff)
downloadhaskell-c5d2d92ce6295d7236c9e8a66a47e741d6f5388b.tar.gz
Comments
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcSimplify.lhs24
-rw-r--r--compiler/types/FunDeps.lhs1
2 files changed, 22 insertions, 3 deletions
diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs
index 3c8160cbcb..8b3724a921 100644
--- a/compiler/typecheck/TcSimplify.lhs
+++ b/compiler/typecheck/TcSimplify.lhs
@@ -86,6 +86,24 @@ import DynFlags ( DynFlags(ctxtStkDepth),
Notes on functional dependencies (a bug)
--------------------------------------
+Consider this:
+
+ class C a b | a -> b
+ class D a b | a -> b
+
+ instance D a b => C a b -- Undecidable
+ -- (Not sure if it's crucial to this eg)
+ f :: C a b => a -> Bool
+ f _ = True
+
+ g :: C a b => a -> Bool
+ g = f
+
+Here f typechecks, but g does not!! Reason: before doing improvement,
+we reduce the (C a b1) constraint from the call of f to (D a b1).
+
+Here is a more complicated example:
+
| > class Foo a b | a->b
| >
| > class Bar a b | a->b
@@ -257,9 +275,9 @@ any other type variables.
- --------------------------------------
- Notes on ambiguity
- --------------------------------------
+-------------------------------------
+ Note [Ambiguity]
+-------------------------------------
It's very hard to be certain when a type is ambiguous. Consider
diff --git a/compiler/types/FunDeps.lhs b/compiler/types/FunDeps.lhs
index 9347f5f665..7000075062 100644
--- a/compiler/types/FunDeps.lhs
+++ b/compiler/types/FunDeps.lhs
@@ -125,6 +125,7 @@ oclose preds fixed_tvs
\begin{code}
grow :: [PredType] -> TyVarSet -> TyVarSet
+-- See Note [Ambiguity] in TcSimplify
grow preds fixed_tvs
| null preds = fixed_tvs
| otherwise = loop fixed_tvs