Fix a bug in the handling of implication constraints (Trac #1430)
authorsimonpj@microsoft.com <unknown>
Tue, 19 Jun 2007 16:26:13 +0000 (16:26 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 19 Jun 2007 16:26:13 +0000 (16:26 +0000)
commitab241c5d6187a93acffc609bdbffdae30ff9b284
tree28be04f89f747dddbf5bec22db67aa8e4ffa629a
parent650f62a575269051098961a9d1b165c49531529c
Fix a bug in the handling of implication constraints (Trac #1430)

Trac #1430 showed up quite a nasty bug in the handling of implication
constraints when we are *inferring* the type of a function.
See Note [Inference and implication constraints]:

  We can't (or at least don't) abstract over implications.  But we might
  have an implication constraint (perhaps arising from a nested pattern
  match) like
   C a => D a
  when we are now trying to quantify over 'a'.  Our best approximation
  is to make (D a) part of the inferred context, so we can use that to
  discharge the implication. Hence getImplicWanteds.

My solution is not marvellous, but it's better than before.  I transferred
function getDefaultableDicts from Inst to TcSimplify (since it's only
called there).  Many of the remaining 50 new lines are comments.  But
there is undoubtedly more code than before (sigh).

Test is tc228.
compiler/typecheck/Inst.lhs
compiler/typecheck/TcSimplify.lhs