#5978: Type error in one function causes wrong type error report in another function in the presence of functionally dependent types ----------------------------------------+----------------------------------- Reporter: Lemming | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.4.1 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: GHC rejects valid program Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------------+----------------------------------- Changes (by simonpj):
* cc: dimitris@… (added) Comment: OK I see what is happening. From the two definitions we get these "wanted" constraints: {{{ monoFoo: mf1: C Float alpha monoBar: mb1: C Float beta, mb2: C Double beta }}} where `alpha` and `beta` are otherwise-unconstrained unification variables. Now if we first do fundeps wrt the `instance` decls, we get `alpha = Char` from `mf1`, `beta = Char` from `mb1` and `beta = Bool` from `mb2`, the latter two yield an error. But if we first do fundeps ''between'' the wanted constraints, we get `alpha = beta`, so that leaves us with `(mf1: C Float alpha, mb2: C Double alpha)`. Now we can solve `mb2` via the fundep with the `instance` to give `alpha=Bool`, and that leaves an error for the innocent `mf1`! Even this isn't quite what happens. Functional dependencies are a pain. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5978#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs