[GHC] #13371: instance selection too eager

GHC ghc-devs at haskell.org
Sat Mar 4 20:38:31 UTC 2017


#13371: instance selection too eager
-------------------------------------+-------------------------------------
        Reporter:  aavogt            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by niteria):

 This reproduces on recent HEAD.

 This appears to be another case of unspoken assumptions about the order.

 On top of c9bcaf3165586ac214fa694e61c55eb45eb131ab it suffices to make
 this change:

 {{{
 --- a/compiler/typecheck/TcMType.hs
 +++ b/compiler/typecheck/TcMType.hs
 @@ -874,7 +874,7 @@ quantifyZonkedTyVars gbl_tvs (DV{ dv_kvs = dep_tkvs,
 dv_tvs = nondep_tkvs })
                   -- closeOverKinds all_cvs: do not quantify over coercion
                   --    variables, or any any tvs that a covar depends on

 -             nondep_tvs = dVarSetElems $
 +             nondep_tvs = varSetElems . dVarSetToVarSet $
                            nondep_tkvs `dVarSetMinusVarSet` gbl_tvs
                   -- No worry about dependent covars here; they are
                   --    all in dep_tkvs
 }}}

 to make the problem go away. It also fixes the problem on HEAD, except you
 have to use `nonDetEltsUFM` instead of `varSetElems`.

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


More information about the ghc-tickets mailing list