#2256: Incompleteness of type inference: must quantify over implication
constraints
---------------------------------+------------------------------------------
Reporter: simonpj | Owner: simonpj
Type: bug | Status: new
Priority: low | Milestone: 7.0.1
Component: Compiler | Version: 6.8.2
Keywords: | Testcase:
Blockedby: | Difficulty: Unknown
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Changes (by simonpj):
* failure: => None/Unknown
Comment:
OK, with the new typechecker the BUG WARNING problem has gone away.
However, when we are attempting to generalise a local binding (remember,
this isn't recommended; I'd prefer to have `-XMonoLocalBinds` on), there
is a fixable incompleteness in the algorithm. Specifically, suppose we
are generalising a let-binding with constraints `(Eq a, (forall b. Ord b
=> ...a...b....))`, and we want to generalise over `a`. Then
* When generalising, we call `simplifyAsMuchAsPossible`.
* This in turn fails if it can't eliminate all implication constraints.
So Iavor's example fails with
{{{
T2256.hs:4:27:
Could not deduce (Eq (f b c)) from the context (Eq c)
arising from a use of `sig'
}}}
* A slightly more generous plan would be [[BR]][[BR]]
* EITHER not to generalise over any variables mentioned in the
implication, and float it. In the example, don't generalise over `a`
after all.[[BR]][[BR]]
* OR to abstract over the quantified type variables constaints, and
float that, in the hope that some later unification will render it
soluble. In the example, generate the implication `(forall a. Eq a =>
(forall b. Ord b => ...a...b...))`.
I'm not sure which is better, and it's very obscure anyway, so I don't
think it's high priority. I'm just making these notes while I think of
them.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2256#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs