• Simon Peyton Jones's avatar
    Another major improvement of "improvement" · ddbb97d0
    Simon Peyton Jones authored
    I wasn't very happy with my fix to Trac #10009. This is much better.
    
    The main idea is that the inert set now contains a "model", which
    embodies *all* the (nominal) equalities that we know about, with
    a view to exposing unifications.  This requires a lot fewer iterations
    of the solver than before.
    
    There are extensive comments in
     TcSMonad:  Note [inert_model: the inert model]
                Note [Adding an inert canonical constraint the InertCans]
    
    The big changes are
    
      * New inert_model field in InertCans
    
      * Functions addInertEq, addInertCan deal with adding a
        constraint, maintaining the model
    
      * A nice improvement is that unification variables can
        unify with fmvs, so that from, say   alpha ~ fmv
        we get              alpha := fmv
        See Note [Orientation of equalities with fmvs] in TcFlatten
        It's still not perfect, as the Note explains
    
    New flag -fconstraint-solver-iterations=n, allows us to control
    the number of constraint solver iterations, and in particular
    will flag up when it's more than a small number.
    
    Performance is generally slightly better:
    T5837 is a lot better for some reason.
    ddbb97d0
TcInteract.hs 77.7 KB