• Simon Peyton Jones's avatar
    Refactor the constraint solver (again!) · 06aac68d
    Simon Peyton Jones authored
    There are three core changes here:
    a) In the constraint-solver pipeline.
       Given a work-item 'wi', the old scheme was:
          let relevant = getRelevantInerts wi
          interact 'wi' with each constraint in 'relevant'
       Bu now we have a single step
          interact 'wi' with the inert-set
       This turns out to avoid duplication, between getRelevantInerts
       (which needs to know which are relevant) and the interact step.
       Simpler, cleaner.
       This in turn made it sensible to combine the 'spontaneous solve'
       stage into the 'interact with inerts' stage.
    b) Wanteds are no longer used to rewrite wanteds.  See Trac #8450.
       This in turn means that the inert set may have
         - many CFunEqCans with the same LHS
         - many CTyEqCans  with the same LHS
       Hence the EqualCtList in teh domain of inert_eqs and inert_funeqs
    c) Some refactoring of the representation of the inert set,
       Notably inert_dicts and inert_funeqs are indexed by Class and TyCon
       respectively, so we can easily get all the constraints relevant to
       that class or tycon
    There are many knock on effects!  This started as a small job but I
    ended up doing qite a lot.  Some error messages in the test suite
    really did improve as a result of (b)
TcErrors.lhs 57.8 KB