Skip to content
  • Simon Peyton Jones's avatar
    Fix a bug in the handling of implication constraints (Trac #1430) · ab241c5d
    Simon Peyton Jones authored
    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.  
    
    
    ab241c5d