[GHC] #10009: type inference regression when faking injective type families

GHC ghc-devs at haskell.org
Thu Jun 11 12:32:22 UTC 2015


#10009: type inference regression when faking injective type families
-------------------------------------+-------------------------------------
        Reporter:  aavogt            |                   Owner:
            Type:  bug               |                  Status:  merge
        Priority:  highest           |               Milestone:  7.10.2
       Component:  Compiler (Type    |                 Version:  7.10.1-rc1
  checker)                           |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  GHC rejects       |               Test Case:
  valid program                      |                Blocking:
      Blocked By:                    |  Differential Revisions:
 Related Tickets:  #10226            |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"ddbb97d00fdbc5870a4076ed15af8e607b161cb2/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="ddbb97d00fdbc5870a4076ed15af8e607b161cb2"
 Another major improvement of "improvement"

 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.
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10009#comment:33>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list