[GHC] #13371: instance selection too eager

GHC ghc-devs at haskell.org
Fri Mar 3 20:59:12 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:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * cc: niteria (added)


Comment:

 I tried to figure out where in the 8.0.2 branch this regression was
 introduced. Unfortunately, I wasn't able to isolate an exact commit,
 because the range of commits in which it was introduced doesn't build.
 However, I know for sure it was introduced between:

 * cc02156b859159eff7d86043f67826c17f2bd170 (where the bug is not present):

 {{{
 From cc02156b859159eff7d86043f67826c17f2bd170 Mon Sep 17 00:00:00 2001
 From: Bartosz Nitka <niteria at gmail.com>
 Date: Mon, 18 Apr 2016 07:32:03 -0700
 Subject: [PATCH] Make benign non-determinism in pretty-printing more
 obvious

 This change takes us one step closer to being able to remove
 `varSetElemsWellScoped`. The end goal is to make every source
 of non-determinism obvious at the source level, so that when
 we achieve determinism it doesn't get broken accidentally.

 Test Plan: compile GHC

 Reviewers: simonmar, goldfire, simonpj, austin, bgamari

 Reviewed By: simonpj

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D2123

 GHC Trac Issues: #4012

 (cherry picked from commit 0f96686b10fd36d479a54c71a6e1753193e85347)
 }}}

 * ae94a31e7f162b4a3ef6b6f837bd6006a98f639a (where the bug is present):

 {{{
 From ae94a31e7f162b4a3ef6b6f837bd6006a98f639a Mon Sep 17 00:00:00 2001
 From: Simon Peyton Jones <simonpj at microsoft.com>
 Date: Fri, 22 Apr 2016 10:47:14 +0100
 Subject: [PATCH] Refactor free tyvars on LHS of rules

 A RULE can have unbound meta-tyvars on the LHS.  Consider
   data T a = C

   foo :: T a -> Int
   foo C = 1

   {-# RULES "myrule"  foo C = 1 #-}

 After type checking the LHS becomes (foo alpha (C alpah)) and we do
 not want to zap the unbound meta-tyvar 'alpha' to Any, because that
 limits the applicability of the rule.  Instead, we want to quantify
 over it!

 Previously there was a rather clunky implementation of this
 quantification, buried in the zonker in TcHsSyn (zonkTvCollecting).

 This patch refactors it so that the zonker just turns the meta-tyvar
 into a skolem, and the desugarer adds the quantification.  See DsBinds
 Note [Free tyvars on rule LHS]. As it happened, the desugarer was
 already doing something similar for dictionaries. See DsBinds
 Note [Free dictionaries on rule LHS]

 No change in functionality, but less cruft.

 (cherry picked from commit 6ad2b42f866fa718855cc5c850e3549bc1428b3c)
 }}}

 I doubt that ae94a31e7f162b4a3ef6b6f837bd6006a98f639a was responsible,
 since it seems to only touch rewrite RULES. Furthermore, niteria authored
 all commits between cc02156b859159eff7d86043f67826c17f2bd170 and that
 point. Do you have a hunch what might be happening here, niteria?

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


More information about the ghc-tickets mailing list