Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
c5d2d92c
Commit
c5d2d92c
authored
Sep 18, 2006
by
simonpj@microsoft.com
Browse files
Comments
parent
40f5a075
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/typecheck/TcSimplify.lhs
View file @
c5d2d92c
...
...
@@ -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.
-
-------------------------------------
Note
s on a
mbiguity
-
-------------------------------------
-------------------------------------
Note
[A
mbiguity
]
-------------------------------------
It's very hard to be certain when a type is ambiguous. Consider
...
...
compiler/types/FunDeps.lhs
View file @
c5d2d92c
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment